GraphQL vs REST

Debates on whether GraphQL solves REST API issues like N+1 queries, over-fetching, and multiple requests, including discussions on performance, optimization, caching, and tools like DataLoader.

📉 Falling 0.3x Web Development
1,953
Comments
15
Years Active
5
Top Authors
#7966
Topic ID

Activity Over Time

2011
1
2012
1
2013
1
2014
1
2015
78
2016
81
2017
224
2018
210
2019
185
2020
318
2021
223
2022
211
2023
166
2024
154
2025
99

Keywords

DataLoader stripe.com tailwind.css LIFO UI UNLESS HTTPS GET ORM www.to graphql queries query data rest relay cache api caching client

Sample Comments

golergka Feb 29, 2024 View on HN

Wasn't the whole point of GraphQL in mitigating this?

ricardobeat Oct 5, 2018 View on HN

The author is missing a few important notions:- graphQL server is storage-agnostic. It allows you to mix databases, APIs, anything, into one cohesive queryable model. It acts as a hub for several data sources. Consumers don’t need to care- queries are easily composable, reusable, and can be aggregated for batching, deduplication and optimisation (can be done with a query planner, but is way more complex)- it’s safe enough for queries to be sent directly from the client on user devices

k__ Jan 18, 2024 View on HN

Didn't GraphQL solve this issue already anyway?

zelly Feb 13, 2020 View on HN

Isn't this what GraphQL was designed to solve?

jrsj Mar 15, 2021 View on HN

Big missing con for GraphQL here — optimization. Doing the right thing in simple cases is easy; in more complex cases you’re looking at having to do custom operations based on query introspection which is an even bigger pain in the ass than using REST in the first place UNLESS all of your data is in one database OR if you’re using it as a middleman between your clients and other backend services, you have a single read-through cache like Facebook which allows you to basically act as if everythin

hansonkd May 30, 2024 View on HN

What? GraphQL is purpose built to solve that in 1 Query. Not doing it in 1 query is on you not the protocol.In practice with REST the frontend engineer didn't want to wait and tried to use the existing REST endpoints, did N+1 API HTTPS calls and then joined them client side in javascript.

jesstaa Jan 14, 2016 View on HN

If it's actually a REST API then it's going to take multiple queries. Certainly you can put an non REST API in front of it to reduce the queries. Every site does it and every site does it in a different way. GraphQL is built to solve this exact problem in a standard way.

jrs95 Dec 13, 2016 View on HN

Does GraphQL actually provide performance advantages right now? From what I've read about it, it seems like it suffers from a bit of an N+1 queries problem if you don't do a lot of custom optimization, which seemed like considerably more work than a REST API.

true_religion Sep 14, 2021 View on HN

I just use GraphQL and freeze the queries at compile time so only known queries can be used. That stops worries about misuse from the frontend.On the backend, for performance we have two choices:1. Over-fetch. It's relatively cheap doing that from a cache. Most queries don't use too many different variations.2. Optimize what data we fetch based on the node's children in the GraphQL query received. I don't think people do this often enough but... GraphQL gives you the

jimmcslim Jun 1, 2025 View on HN

I understand the GraphQL has fallen out of favour somewhat, but wasn’t it intended to solve for this?