MySQL Big Data paging query optimization

Source: Internet
Author: User

application scenarios;

When there is a table of data is very large, need to use to paging query, paging query after 100w query efficiency is very low;

Solution:

1, Business layer resolution: Only allow users to page 100 pages, 10 pages;

2. Use where ID > 5000000 limit 10; Data integrity is required, but you can consider the last ID that was checked each time you queried.

3. Deferred query: Select Table.id,table.name LEFT JOIN (SELECT ID from table limit 5000000,10) as tmp on table.id = tmp.id;id as index; 500w after the introduction of the ID, speed thief fast. Then through the index ID to query the corresponding each piece of data; Sudoku is fast; but it takes some time to query through the relational table in the mass data, but it is more than a few times higher than the previous one;

MySQL Big Data paging query optimization

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.