Nice write up! I don't have any GraphQL experience, but I'm trying to get into it. I've got one question about the paragraph:
This is very negligent as GraphQL it's all about reducing the number of database calls. The GraphQL preferable way is nesting the output types which makes it easier to call your database with a single request and batch your data:
As far as I understand it, DataLoader's batching works on the event-loop level. When it comes to SQL databases it'd still be the responsibility of the backend that fetches the data from the database to actually provide the right (optimized) query, right? I mean, a batch could still result in several SQL SELECTs, if a query with a, e.g., WHERE clause, isn't available.
In my opinion dataLoader is more abstract tool which can be used within specific patterns. It doesn't replace SQL queries of course, but you might be confused by a lot of SQL examples inside README. Using it with resolvers and GraphLQ is up to you. You can reduce the number of calls if you want to query just exact fields.
+1 - I have same question. API returns the results all at once, but database get queried in each loop, instead of joins that are possible in most SQL data sources.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice write up! I don't have any GraphQL experience, but I'm trying to get into it. I've got one question about the paragraph:
As far as I understand it, DataLoader's batching works on the event-loop level. When it comes to SQL databases it'd still be the responsibility of the backend that fetches the data from the database to actually provide the right (optimized) query, right? I mean, a batch could still result in several SQL SELECTs, if a query with a, e.g., WHERE clause, isn't available.
In my opinion dataLoader is more abstract tool which can be used within specific patterns. It doesn't replace SQL queries of course, but you might be confused by a lot of SQL examples inside README. Using it with resolvers and GraphLQ is up to you. You can reduce the number of calls if you want to query just exact fields.
+1 - I have same question. API returns the results all at once, but database get queried in each loop, instead of joins that are possible in most SQL data sources.