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
83
Introduction to Flask
ngalambackend
0
180
Achieving API Performance and Scalability
ngalambackend
0
87
Interfaces in Go
ngalambackend
0
61
CSS in JS in action
ngalambackend
0
57
Productive Remote Working with Scrum
ngalambackend
0
98
Covid Tracker Kota Malang
ngalambackend
0
69
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
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
200
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.8k
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
390
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
140
株式会社 Sun terras カンパニーデック
sunterras
0
2.1k
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
400
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
110
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
730
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
370
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
310
Featured
See All Featured
How GitHub (no longer) Works
holman
316
140k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
250
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
480
Ruling the World: When Life Gets Gamed
codingconduct
0
170
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
51k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
Crafting Experiences
bethany
1
84
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
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