JOIN queries vs multiple queries(JOIN 查询与多个查询)
问题描述
JOIN 查询是否比多个查询更快?(您运行主查询,然后根据主查询的结果运行许多其他 SELECT)
Are JOIN queries faster than several queries? (You run your main query, and then you run many other SELECTs based on the results from your main query)
我这么问是因为加入它们会使我的应用程序的设计复杂化
I'm asking because JOINing them would complicate A LOT the design of my application
如果它们更快,有人能粗略估计大约多少吗?如果是 1.5 倍我不在乎,但如果是 10 倍我想我会.
If they are faster, can anyone approximate very roughly by how much? If it's 1.5x I don't care, but if it's 10x I guess I do.
推荐答案
这太模糊了,无法为您提供与您的具体案例相关的答案.这取决于很多事情.Jeff Atwood(本网站的创始人)实际上 写道这个.不过,在大多数情况下,如果您拥有正确的索引并且正确执行 JOIN,那么执行 1 次行程通常比执行多次行程要快.
This is way too vague to give you an answer relevant to your specific case. It depends on a lot of things. Jeff Atwood (founder of this site) actually wrote about this. For the most part, though, if you have the right indexes and you properly do your JOINs it is usually going to be faster to do 1 trip than several.
这篇关于JOIN 查询与多个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JOIN 查询与多个查询


基础教程推荐
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01