This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9950|Reply: 0

[Communication] SQL Server 2012 provides OFFSET/FETCH NEXT vs. Row_Number() for comparison testing

[Copy link]
Posted on 5/7/2019 10:35:50 AM | | | |
SQL Server 2012 uses OFFSET/FETCH NEXT pagination, which is a significant improvement over RowNumber() in SQL Server 2005/2008. Today I specially did a simple test. The process is shared as follows:

P.S. My test environment is:

SQL Server 2012, named instances

Microsoft SQL Server 2012 - 11.0.2100.60 (Intel X86)
Feb 10 2012 19:13:17
Copyright (c) Microsoft Corporation
Enterprise Edition on Windows NT 6.0 <X86> (Build 6002: Service Pack 2)

The test database and table above are used:

After inserting 10,000 pieces of data, execute Row_Number in SQL Server 2008 R2 ():


In SQL Server 2012, execute the OFFSET/FETCH NEXT statement as follows:



Execute the following statement in SQL Server 2012:



Conclusion: The OFFSET/FETCH NEXT pagination method provided by SQL Server 2012 is greatly improved compared to the Row_Number() method in terms of key parameters such as the number of logical reads, response time, and the number of lines actually executed.





Previous:Microsoft officially announced the .NET 5 release
Next:The vscode search icon is missing
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com