Efficient Paging for Oracle database queries

Source: Internet
Author: User
Linq provides Skip and Take APIs for paging. Because EntityFramework is used, it is better to use EFProfiler to view the generated SQL with curiosity. This mainly refers to the use of analysis functions such as row_numer () over (). You can find the starting point of the first row, and then retrieve 30 rows.

Linq provides Skip and Take APIs for paging. Because Entity Framework is used, you can use EFProfiler to view the generated SQL statements with curiosity. This mainly refers to the use of analysis functions such as row_numer () over (). You can find the starting point of the first row, and then retrieve 30 rows.

Linq provides Skip and Take APIs for paging. Because Entity Framework is used, you can use EFProfiler to view the generated SQL statements with curiosity. This mainly refers to the use of analysis functions such as row_numer () over (), where you can directly find the starting point of the 5,000th rows, and then retrieve 30 rows.

 
  1. select *
  2. from (select *
  3. from (select t.*,
  4. row_number() OVER(ORDER BY null) AS "row_number"
  5. from yz_bingrenyz t) p
  6. where p."row_number" > 5000
  7. ) q
  8. where rownum <= 30

Comparative analysis:

It takes 1.3 s for the local machine to test the former, and 0.25 s for the latter. The difference can also be seen from the following execution plans.

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.