简体   繁体   中英

What is the most optimized way to write a paged query in SQL Server 2005?

I know several ways of writing paged query in SQL Server 2005. But I have no idea about their performance. Which one is the best and most optimized way for writing paging SQL queries?

  1. Using Row_Number()
  2. Using Partition by
  3. Using Temporary tables
  4. Using Nest Top N with Order by
  5. Some other way?

以我的经验,它使用的是ROW_NUMBER(),只需确保orderby字段是聚簇索引,这样您就不必为对每个查询的数据集进行排序而付出代价。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM