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
48
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
77
Introduction to Flask
ngalambackend
0
160
Achieving API Performance and Scalability
ngalambackend
0
85
Interfaces in Go
ngalambackend
0
57
CSS in JS in action
ngalambackend
0
56
Productive Remote Working with Scrum
ngalambackend
0
79
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
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
5
1.1k
Team operations that are not burdened by SRE
kazatohiei
1
320
AI Agent 時代のソフトウェア開発を支える AWS Cloud Development Kit (CDK)
konokenj
3
270
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
210
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
270
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
190
Startups on Rails in Past, Present and Future–Irina Nazarova, RailsConf 2025
irinanazarova
0
140
RailsGirls IZUMO スポンサーLT
16bitidol
0
190
効率的な開発手段として VRTを活用する
ishkawa
0
150
VS Code Update for GitHub Copilot
74th
2
660
What's new in AppKit on macOS 26
1024jp
0
110
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
3
490
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Optimising Largest Contentful Paint
csswizardry
37
3.3k
Into the Great Unknown - MozCon
thekraken
40
1.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
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