Oracle paging SQL statement

Source: Internet
Author: User


Oracle paging SQL statement 1. select * from t_xiaoxi where ROWID in (select rid from (select rownum rn, rid from (select rowid rid, cid fromt_xiaoxi order by cid desc) where rownum <10000) where rn> 9980) order by cid desc; execution time 0.03 seconds 2. 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 www.2cto.com
3. select * from (select t. *, rownum rn from (select * from t_xiaoxi order by cid desc) t where rownum <10000) wherern> 9980; execution time: 0.1 seconds, where t_xiaoxi is the table name, cid is the key field of the table, and records 9981-9999 are obtained after the CID is sorted in descending order. The t_xiaoxi table has more than 70000 records, and the personal feeling 1 is the best, followed by 3, 2. The worst author, mark_qi

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.