My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

To GraphQL or not to GraphQL when using Sequelize?

Ajar's photo
Ajar
·May 23, 2016

Use GraphQL on top

72%

Use Sequelize on its own

28%

18 votes · Closed

Hi all,

We are experimenting with GraphQL and Sequelize, the Node.js ORM for relational database (we had a requirement to use a relational DB).

I've noticed that when I use Sequelize on its own to make a joined query from a few tables it produces a single query but we have to write some code to parse it and map the relations between the entities. More work for us, less flexibility to change it later.

When I used GraphQL on top, the data is of course returned exactly in the JSON structure the client needs, but in the console I could notice the queries number increasing exponentially for every join we add.

Which brings me to the question - to GraphQL? or not to GraphQL? is there a way to optimize its performance to produce less queries?

Are many queries a non-issue for the most part?

Should we worry about performance only when we'll hit those issues at scale? and then what, re-write optimized hand written SQL queries?

What's your take on it?