Oracle Paging SQL statement three pagination technology

Source: Internet
Author: User
Tags time 0

1. According to rowID to divide
SELECT * from T_xiaoxi where rowID in (the Select Rid from (select RowNum rn,rid from, select rowID rid,cid from

T_xiaoxi ORDER BY cid Desc) where rownum<10000) where rn>9980) the ORDER by CID Desc;
Execution time 0.03 seconds


2. According to the analysis function to divide
SELECT * FROM (select T.*,row_number () over (order BY CID Desc) rk from T_xiaoxi T) where rk<10000 and rk>9980;
Execution time 1.01 seconds

3. Press RowNum to divide
SELECT * FROM (select T.*,rownum rn from (SELECT * from T_xiaoxi ORDER BY cid Desc) t where rownum<10000) where

rn>9980; Execution Time 0.1 sec.
Where T_xiaoxi is the table name, CID is the key field of the table, the 第9981-9999条 record is sorted by CID descending, and the T_xiaoxi table has more than 70,000 records.
Personal feeling 1 efficiency best, 3 times, 2 worst

Oracle Paging SQL statement three pagination technology

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.