日期:2014-05-17  浏览次数:20483 次

关于“TOP”的效率问题求助
表A有两千万条数据,有SequenceCode列,类型为Int,值是顺序数字。

code, sequncecode

aabcb1233, 1
xxxxb1233, 2
zzfdsb123, 3
.......
pupjfs233, 20000000


因为听说SQL SERVER对于TOP有特别的优化,所以请问如下两个语句,哪个效率更高

select top 10 * from 表A where sequncecode >= 10080

select top 10 * from 表A where sequncecode between 10080 and 10099

------解决方案--------------------
select top 10 * from 表A where sequncecode >= 10080
 
 select top 10 * from 表A where sequncecode between 10080 and 10099
你这两个都不同的语句,如果你的数据只到10099,而且有索引,那么下面那个快