GraphQL vs REST: how field selection cuts over-fetching in a profile card

The article compares GraphQL and REST by how much data each sends to fill a simple profile card showing a name and three post titles. A classic REST design returns whole resources with unused fields, which is over-fetching, while GraphQL lets the client select only the fields it needs. In a seeded lab test over 500 runs, plain REST sent about 21,400 bytes per card, while a trimmed REST call and a single GraphQL query each sent roughly 220 bytes. The author notes caveats: the test ran in one process without real network, compression, or a production GraphQL engine. Field selection shrinks responses, but the database reads only shrink if the resolvers are written to load less data.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in