It seems that few people are talking about paging, are we all addicted to limit m,n?
In the case of indexing, limit m,n speed is sufficient, but when searching for complex conditions,
where somthing ORDER by Somefield+somefield
MySQL searches the database for "all" qualifying records, and then takes out the M,n record.
If you have hundreds of thousands of data, and the user searches for some very popular words,
Then read the last few pages in turn wonderment ... MySQL should be very solemn and stirring operation of the hard drive.
So, you can try to let MySQL also store pagination, of course, to program with.
(Here is just an idea, welcome to discuss it together)
ASP paging: In the ASP system has a Recordset object to achieve paging, but a large number of data in memory, and do not know when the expiration (please ASP Master
Pointing).
SQL database paging: Using stored procedures + cursor paging, the implementation of the principle is not very clear, imagine if you use a query to get the desired results, or
ID sets that require subsequent pages to read the relevant records according to the IDs in the results. This allows for a small space to keep all IDs of this query. (Query knot in SQL
Do not know how to clear expired rubbish?
This allows MySQL to simulate a storage paging mechanism:
1. Select id from $table where $condition order by $field limit $max _pages* $count;
Query for IDs that match the criteria.
Limit the number of records that meet the maximum criteria, or you can not add them.