Using sql "related" queries seems very slow


#1

I have been trying the automated join queries provide via the “related” keyword I have noticed that even on a very small table (< 10 records) with a single related field, the query takes almost 100% longer. As I add more related fields it takes even longer. Normally this would be a very simple join that should be very quick… Is this normal?


#2

Is no one else having this problem?


#3

I’ve actually noticed that ALL queries going through dreamfactory are quite a bit slower then running straight sql… referenced queries just being noticeably more slow. Is there something wrong with the way we set it up? I would assume that under the covers the only thing dreamfactory should be doing is generating sql statements and executing them, so I can’t imagine where the slow down would be.


#4

The number of relationships requested and the network latency between the DreamFactory server and the database server can contribute to slow response times. In DF related queries are not actual joins, but separate queries that DF puts together into one returned data set.
API access to data will always be marginally slower than direct querying the database because of the slight additional overhead of the DF system, however those time differences should be inconsequential.

When testing something like this, it’s a good idea to set up a secondary set of datasources and API endpoints to eliminate possible causes like misconfiguration or network issues.