How many pages are queried by mysqllimit page and how many limit pages have performance problems?

Source: Internet
Author: User
Generally, there are about 20 pieces of data on the pages of the article. I don't know why, where is the maximum performance bottleneck of limit, where is the maximum value, and if there are any problems with getting 5000 entries at a time, 10000 entries, it is too difficult to retrieve 20 entries by page. For a long time, I have... generally, the article pages contain about 20 limit data records. I don't know why, where is the maximum performance bottleneck of limit, where is the maximum value, and if there are 5000 limit records at a time, is there any problem? What about 10000 records, it is too difficult to retrieve 20 entries by page.

I have always had a problem:

1: When is paging required,
2: when is there a limit on limit,
3: When can I directly obtain all the data?

For example, on the ELE. Me restaurant page, there may be many types of restaurants, and there are still many dishes under each category. In this case, does it directly obtain all the data? Is there no limit on limit?

If the number of categories is small, you don't need to use limit to retrieve them all, but the number of dishes under each category may be a little large (for example, I don't know how many dishes there are) do I need to use limit to retrieve each of the following dishes? How many limit items are required? If so, isn't there a possibility of "click to view more meals ", do not use AJAX to retrieve the remaining data. How can I retrieve the remaining data?

The concept is like this, but I am still dizzy. I hope the great gods can help me with the examples I 've mentioned. Thank you!

Reply content:

Generally, the article pages contain about 20 limit data records. I don't know why, where is the maximum performance bottleneck of limit, where is the maximum value, and if there are 5000 limit records at a time, is there any problem? What about 10000 records, it is too difficult to retrieve 20 entries by page.

I have always had a problem:

1: When is paging required,
2: when is there a limit on limit,
3: When can I directly obtain all the data?

For example, on the ELE. Me restaurant page, there may be many types of restaurants, and there are still many dishes under each category. In this case, does it directly obtain all the data? Is there no limit on limit?

If the number of categories is small, you don't need to use limit to retrieve them all, but the number of dishes under each category may be a little large (for example, I don't know how many dishes there are) do I need to use limit to retrieve each of the following dishes? How many limit items are required? If so, isn't there a possibility of "click to view more meals ", do not use AJAX to retrieve the remaining data. How can I retrieve the remaining data?

The concept is like this, but I am still dizzy. I hope the great gods can help me with the examples I 've mentioned. Thank you!

  1. When is paging required?
    When the data volume in the table is large, you should consider paging.

  2. When is there a limit on limit?
    Same as above

  3. When can I directly obtain all the data?
    When the data volume in the table is small, all data can be retrieved at a time.

Reading 20 pieces of data and reading 5000 or more pieces of data is definitely 20 faster in performance. In addition, this speed is not only reflected in the database, but also in the transmission process on the network (the data volume is small, of course, fast). page rendering is in progress (the display page is faster if the data volume is small ). In addition, even if you display 5000 pieces of data at a time, the vast majority of users will be able to see 20 or 30 pieces of data, and will not read all 5000 pieces of data, so excessive data is a waste.

If it is a small element (such as only text, or an element with less information), the single page size is set to less than 100. If it is a large element (with a large amount of information, such as text and text), it is best to control the single page volume below 30.

Enough. It is a waste.
You can only view 20 entries, and 21 entries are not required.
If hundreds or even thousands of records are returned, the impact will be huge.
First, the database query is slow, occupying more server resources. After the results are found, the transmission is slow, occupying more bandwidth resources. Second, the rendering is slow, and the browser crashes.

You don't have to think too much about it. This is just a product, usually 20 ~ 30 entries. The number of entries displayed is completely beautiful. Of course, when can you directly obtain all the data. This is absolutely impossible. How can we obtain all the data? If the article volume reaches tens of millions, it will take too long to retrieve it.

Page 20, but why not, mainly on the first floor,Not used, not used, not used

A database usually has a configuration to configure the maximum size of the data returned by each query request. Generally, this limit is not exceeded. as long as the limit is not exceeded, it is okay. however, the on-demand acquisition principle is generally adopted. In principle, you do not need to take so many resources if you do not need to take so many resources. After all, you have to use the bandwidth of the NIC. For example, assume that you are a network card of MB and the bandwidth consumed by limit is 10 KB, so from the perspective of network card bandwidth (not to mention database performance problems first) the maximum QPS is 1000 M/10 K = 10 w qps. of course, if your network card can be on a 10-Gigabit network card. in addition, each request to obtain more data also reduces the request arrival speed.

Bandwidth consumed by network transmission
Bandwidth consumed by network transmission
Bandwidth consumed by network transmission
Important: 3 times

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.