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 查询与多个查询


- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- SQL 临时表问题 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01