0

Graphql has the ability that it returns only these column which is requested by the front end. But I have a question,Graphql send the query to db for all columns or selected column provided by the frontend. eg. I have a table let's say Users and it have below columns id name addresss phone city

And while using the graphql, I request graphql for only two columns id and name. So when graphql send the query to Database, will it send Select for two columns or it will send request to db for all column and after the DB response then grpahql filter only the requested column and returns to frontend.

Mudasser
  • 11
  • 4
  • See [how to ask a good question](https://stackoverflow.com/help/how-to-ask). But just know that it depends on how resolvers are written. Usually the simplest is to do a `SELECT *` in the resolver and let GraphQL pick the required fields from that. – Michel Floyd May 05 '23 at 18:05
  • Graphql sends request to db based on your code. I want to say that you wrote the code for ``query``. Returns to client only the requested column in the ``result``. If it can't find its column, it throws an error. – myrn Jul 31 '23 at 11:51

0 Answers0