Subqueries vs joins(子查询与连接的比较)
来源:互联网 发布:淘宝上天天特价可靠吗 编辑:程序博客网 时间:2024/06/07 20:55
我认为stackoverflow中有个回答还比较靠谱。
A:
I refactored a slow section of an application we inherited from another company to use an inner join instead of a subquery like
where id in (select id from ... )
The refactored query runs about 100x faster. (~50 seconds to ~0.3) I expected an improvement, but can anyone explain why it was so drastic? The columns used in the where clause were all indexed. Does SQL execute the query in the where clause once per row or something?
Q:
A "correlated subquery" (i.e., one in which the where condition depends on values obtained from the rows of the containing query)will execute once for each row. A non-correlated subquery (one in which the where condition is independent of the containing query)will execute once at the beginning. The SQL engine makes this distinction automatically.
But, yeah, explain-plan will give you the dirty details.
- Subqueries vs joins(子查询与连接的比较)
- 提取表和子查询的区别(derived table vs subqueries)
- Correlated Subqueries 相关子查询
- oracle中的相关子查询(correlated subqueries)
- oracle中的相关子查询(correlated subqueries)
- MySQL的子查询与连接查询
- 子查询与连接
- 连接查询与子查询
- 连接查询与子查询
- 子查询和连接查询性能比较
- 子查询与连接使用指南
- mysql 子查询与连接
- MySQL子查询与连接
- MYSQL子查询与连接
- MySQL子查询与连接
- mysql 两表join与in子查询的比较
- sql子查询与连接查询
- 多表连接查询与子查询
- PHP中的$_SERVER 与 getenv
- HandlerThread
- 无法获得页面Textbox更新值的一个可能的原因
- 修改Squid参数提高缓存效果
- .NET环境下生成JSON的类库 - JSON.NET
- Subqueries vs joins(子查询与连接的比较)
- easyui required=true的提示信息所在位置不对。乱跑的解决办法
- 关于UIKit提供几个Graphics函数
- strftime()函数将时间格式化
- Drexel Autonomous Systems Lab
- C语言 ## __VA_ARGS__ 宏
- c++下使用CString将字符串转二进制、八进制、十进制、十六进制
- Sobel算子实现水平边缘检测、垂直边缘检测;45度、135度角边缘检测
- Ogre 1.9 RC1 发布了,有了官方的Android支持