Paging convenience brought by SQL Server 2005

Source: Internet
Author: User
server| Paging

Select ThreadID from
(
Select ThreadID, Row_number () over (order by stickydate) as Pos from Cs_threads
) as T
where T.pos > 100000 and T.pos < 100030

===========================================

If the table inside the Cs_threads data volume, for example, hundreds of millions of records, then this method should be problematic

Because, select ThreadID from
(
Select ThreadID, Row_number () over (order by stickydate) as Pos from Cs_threads
) as T
where T.pos > 100000 and T.pos < 100030
This statement takes the select ThreadID, Row_number () over (the order by Stickydate) as the Pos from cs_threads it all out, and then pages out of the SQL, not tested on the SQL2005 Because this is not a good way to write on Oracle, as Oracle writes better: SELECT ThreadID from
(
Select ThreadID, Row_number () over (order by stickydate) as Pos from Cs_threads a where a.pos<100030
) as T
where T.pos > 100000




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.