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
49
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
79
Introduction to Flask
ngalambackend
0
160
Achieving API Performance and Scalability
ngalambackend
0
86
Interfaces in Go
ngalambackend
0
57
CSS in JS in action
ngalambackend
0
56
Productive Remote Working with Scrum
ngalambackend
0
87
Covid Tracker Kota Malang
ngalambackend
0
62
Supercharge Local Development with Docker
ngalambackend
1
120
Building Scalable and Flexible API by Leveraging GraphQL and BigTable
ngalambackend
1
310
Other Decks in Programming
See All in Programming
Swift Updates - Learn Languages 2025
koher
2
490
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
AWS発のAIエディタKiroを使ってみた
iriikeita
1
190
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
Rancher と Terraform
fufuhu
2
550
はじめてのMaterial3 Expressive
ym223
2
890
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
230
AIコーディングAgentとの向き合い方
eycjur
0
280
Ruby Parser progress report 2025
yui_knk
1
450
実用的なGOCACHEPROG実装をするために / golang.tokyo #40
mazrean
1
290
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
230
Reading Rails 1.0 Source Code
okuramasafumi
0
250
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
Fireside Chat
paigeccino
39
3.6k
How to Ace a Technical Interview
jacobian
279
23k
Designing for Performance
lara
610
69k
Embracing the Ebb and Flow
colly
87
4.8k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Making Projects Easy
brettharned
117
6.4k
Building an army of robots
kneath
306
46k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
Music & Morning Musume
bryan
46
6.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
53k
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