SQlserver高效分页,还在使用row_number(),top之类的?

时间:2019-09-02 20:15:23   收藏:0   阅读:165

row_number() ,还是top 这些分页的方法比较老了,效率不是很高效的,

Sqlserve2012就有了,效率对比比较明显,尤其是数据比较大的情况下(我们可以观看查询执行计划)

Offset 0 Rows Fetch Next 20 Rows only(需要先排序)

这里只举一个接单的sql,只起到抛砖引玉的作用:

select id,name from Student order by id desc  Offset 0 Rows Fetch Next 20 Rows only

 

原文:https://www.cnblogs.com/Fengge518/p/11448650.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!