Some methods for paging mysql big data ., Mysql DATA Paging

Source: Internet
Author: User

Some methods for paging mysql big data ., Mysql DATA Paging

Select * from user limit; this most common method is okay when the data volume is small

When the data volume is greater than, select * from user limit, 10.

First, we need to scan the first records and then retrieve 10 records. Therefore, when the data volume increases, the speed slows down.


Solution:

1. From the business perspective, the limit can only be obtained from the first 70 pages or the first thirty pages. Such as Baidu and Google search ..

2. select * from user where id> 1000000 limit 10;

In this case, the index is used, so it is faster. If the index is insufficient, the data integrity must be ensured, that is, the previous data cannot

Deleted.

If you want to delete the previous data and want to use this method, you can only delete the data logically, for example, adding an is_del Field

3. select id from user limit 1000000, 10;

First, the id is queried and the index is used. Then, the corresponding data is obtained from the id.

Select id, name from user inner join (select id from user limit 1000000, 10;) as tem on tmp. id = user. id;



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.