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

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

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 的问题,即使能实现限制也很强。