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.