Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Solve N+1 Problem in GraphQl API
Search
Ngalam Backend Community
April 28, 2019
Programming
2
50
Solve N+1 Problem in GraphQl API
Ngalam Backend Community
April 28, 2019
Tweet
Share
More Decks by Ngalam Backend Community
See All by Ngalam Backend Community
Web_Scraping_with_Scrapy.pdf
ngalambackend
0
84
Introduction to Flask
ngalambackend
0
180
Achieving API Performance and Scalability
ngalambackend
0
91
Interfaces in Go
ngalambackend
0
62
CSS in JS in action
ngalambackend
0
59
Productive Remote Working with Scrum
ngalambackend
0
99
Covid Tracker Kota Malang
ngalambackend
0
71
Supercharge Local Development with Docker
ngalambackend
1
130
Building Scalable and Flexible API by Leveraging GraphQL and BigTable
ngalambackend
1
330
Other Decks in Programming
See All in Programming
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
1.1k
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
620
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
680
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
110
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
120
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.4k
見せてもらおうか、 OpenSearchの性能とやらを!
shunta27
1
140
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
4
2k
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
450
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
130
20260315 AWSなんもわからん🥲
chiilog
2
180
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
290
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Exploring anti-patterns in Rails
aemeredith
2
290
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
160
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
76
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
500
WCS-LA-2024
lcolladotor
0
500
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Transcript
Solve N+1 Problem in GraphQL API Disyam Adityana Putra Team
Leader @ Hash Rekayasa Teknologi
Ask The Audience • Raise Your Hand • Know GraphQL
• Try GraphQL • Use GraphQL
N+1 Problem
dataloader to the rescue
dataloader • batching • caching • per request • fetch
data modification
dataloader const DataLoader = require('dataloader') const userLoader = new DataLoader(keys
=> myBatchGetUsers(keys));
dataloader input = [2, 1, 5, 3, 4]; output =
[ { id: 2, name: "two" }, { id: 1, name: "one" }, { id: 5, name: "five" } { id: 3, name: "three" } { id: 4, name: "four" } ];
batching • The Array of values must be the same
length as the Array of keys • Each index in the Array of values must correspond to the same index in the Array of keys
caching const userLoader = new DataLoader(...) const result1 = await
userLoader.load(1) const result2 = await userLoader.load(1) assert(result1 === result2)
Other implementations PHP: DataLoaderPHP Ruby: Dataloader, BatchLoader ReasonML: bs-dataloader Java:
java-dataloader Elixir: dataloader Golang: Dataloader
Question?
Thank You code: https://github.com/disyam/graphql-loader