当我执行下面的查询与执行plan.I可以看到'排序'是最成本的任务。但我没有在我的查询中使用任何排序选项。为什么它正在发生?select之前有一个嵌套循环连接任务。请让我知道关于合并连接,散列连接和嵌套循环连接。为什么在执行计划中有一个排序任务
select
Ename from dbo.Employee e
where
Salary>(
select AVG(Salary) from dbo.Employee where
DeptId=e.DeptId
group by DeptId)
不解决您的排序问题,但[这个总体规划形状的很好的概述是在这里(HTTP:// sqlblog .com/blogs/paul_white/archive/2010/07/28/partitioning-and-the-common-subexpression-spool.aspx) –