首页 相关文章 TOP N 和SET ROWCOUNT N 哪个更快

TOP N 和SET ROWCOUNT N 哪个更快

懒得翻译了,大意:
在有合适的索引的时候,Top n和set rowcount n是一样快的。但是对于一个无序堆来说,top n更快。
原理自己看英文去。

Q. Is using the TOP N clause faster than using SET ROWCOUNT N to return a specific number of rows from a query?

A. With proper indexes, the TOP N clause and SET ROWCOUNT N statement are equally fast, but with unsorted input from a heap, TOP N is faster. With unsorted input, the TOP N operator uses a small internal sorted temporary table in which it replaces only the last row. If the input is nearly sorted, the TOP N engine must delete or insert th...[ 查看全文 ]

2016-01-29 标签:

TOP N 和SET ROWCOUNT N 哪个更快的相关文章

手机页面
收藏网站 回到头部