Row_number () over order by and query paging Efficiency Analysis Using rownum

Source: Internet
Author: User

Actual test:

Database: 0.7 million data records

Query 10 million pages per page.
Row_number () elapsed time: 2.2 seconds
Rownum elapsed time: 1.3 seconds

Query 10 million pages per page.
Row_number () elapsed time: 4.5 seconds +
Rownum elapsed time: 3.8 seconds +

As you can see on the Internet, row_number () is the most efficient and has not been tested by big data.

We also hoped that the row_number () Paging code would be simpler and more efficient to optimize the current system! Disappointing!

Personal analysis: the new paging method (row_number () over (order by T. xxx DESC) Rn sorting method is not highly efficient than 3-layer nested sorting, because order by in over takes a long time (when the data volume reaches 100,000 levels ), in addition, rownum cannot be used in subqueries to reduce the data generated for the first time (because the rownum pseudo columns are arranged when data is retrieved ).

 

 

Row_number () over order by and query paging Efficiency Analysis Using rownum

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.