惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

GraphQL

Graphql 太难用了,难监控性能,难客户端缓存 - V2EX 国内用 GraphQL 的好像不多? - V2EX 请教一个 graphql subscriptions 问题 - V2EX 做前后端分离接口开发时,用 graphql 的多吗? - V2EX 有用过 GraphQL 的吗?可以进来说说相比 restful 的优劣吗? - V2EX Hello GraphQL - V2EX prisma 和 普通 orm 的区别是什么? - V2EX
关于 N+1 问题解决方案的疑问 - V2EX
SakuraSv · 2021-03-31 · via GraphQL
namelosw

1

namelosw      2021 年 3 月 31 日

另外一个没用过,不过 GraphQL 里面常用的 Dataloader 的原理是本来 lazy load 的时候打到 Dataloader 上,记下 id 最后一次执行,本质上并不是直接解决 N + 1,而是把 N + 1 batch 起来,生成很大的 SELECT IN (1, 2, 3 ...)。

而最常见防止 N + 1 的方式就是关闭 Lazy load,然后手动 prefetch —— 效果是放在一条 join 里,比上面一种方法要高效,但是程序员的活多了。

我猜最理想的方式是用类似程序分析的形式把 N + 1 转化成 join 而非 batch,不过感觉好像并不是 non-trivial 的问题,即使能实现限制也很强。