相关疑难解决方法(0)

向此查询添加订单返回比不添加更快,为什么?

关于为什么向此查询添加排序的任何想法比没有 order by 的返回速度要快得多?我希望相反,那么什么会导致这种情况发生?

SELECT TOP (500) r.cID,r.aField,a.Description 
       FROM dbo.tblR r  
            inner join dbo.tblA a on r.aID = a.ID  
            left join dbo.tblX x on x.cID = r.cID 
       WHERE (ISNULL(x.anotherField,'') <> r.anotherField or x.field3 is null) 
            and (r.ID=(select max(ID) from tblR where cID = r.cID and
            ISNULL(aField,'') <> '')) 
            and r.cID in (select ID from tblC)
       ORDER BY r.cID ASC -- when I comment this line out it runs much slower
Run Code Online (Sandbox Code Playgroud)

执行计划没有多大帮助。

sql-server-2005 order-by

6
推荐指数
1
解决办法
2190
查看次数

标签 统计

order-by ×1

sql-server-2005 ×1