MySQL Paging performance optimization

Source: Internet
Author: User

The simplest way to page pagination is this.

Select *  from ORDER  by desc 10000,ten

The table has around 5w of data

The average execution time is around 10s, so the query is very inefficient in the case of large data volumes.

There are several ways to optimize the

1. This method is averaged between 0.04s-0.05s (CreateDate need to be indexed)

Select *  from where ID> (SELECTfromORDERbyDESC10000 ,1)  ORDERbydesc

2. The average of this approach is 0.01s

SELECT *  from WHERE between 10000  and 10020

3. Below 0.01s

Select *  fromExarticletempwhereIdinch(10109,10110,10111,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125,10126,10127,10128,10129,10130)

MySQL Paging performance optimization

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.