Which of the following is better to read all the data in one read and batch by limit?

Source: Internet
Author: User
Which of the following statements can be used to retrieve all data at one time and read data in batches by limit? for example, the database has 0.1 million record URLs & nbsp; is the list page url 1. read these 0.1 million URLs from the database at a time, then foreach collects 2. limit10 first, & nbsp; foreach collects, and then read the database limit, what is the common method for repeated requests? Which of the following statements can I use to retrieve all data at one time and read data in batches by limit?
During collection, for example, the database has 0.1 million recorded URLs as the URLs on the list page.

1. read the 0.1 million URLs from the database at a time, and then perform foreach collection.
2. limit 10 items first. after foreach completes collection, read the database limit and repeat it.

Which method is generally used?

Share:


------ Solution --------------------
Is collection and analysis separated?
If one side is collected, one side is analyzed in batches.
If the separation is performed once, it depends on the machine's affordability.
------ Solution --------------------
If you allow the deposit, why not?
------ Solution --------------------
The reading speed of 0.1 million entries is very fast. how can I use limit? it is too troublesome and will not improve the efficiency.
------ Solution --------------------
What should I do with limit? it's not a database query. Can it improve the efficiency.
------ Solution --------------------
Generally, I recommend reading data in batches. If you must make statistics on a large dataset, the best way is to use the stored procedure on the server side for statistics and then return the statistical results. Although the current network speed and stability are greatly improved, what can be done on the server side is generally not wrong.

However, according to the scenario you described, if you need to collect 0.1 million URLs on the server side, it may be better to save a local cache for the database.
------ Solution --------------------
There is no problem with reading 0.1 million pieces of data at a time. The key is how efficient your collection program is.

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.