Hardware environment: PIII550, 128 M, 15.2G
Software environment: Win98 + Apache + Php4 + MySql
Solution 1:
1. Use Select count (1) from tab where condition for the first query to obtain the number of records meeting the condition $ rows
2. Use the first page $ page to retrieve the record set per page $ rpp
Select * from tab where condition limit ($ page-1) * $ rpp, $ rpp
3. display all records of the returned record set.
4. transfer $ rows to a later page during page transfer.
Solution 2:
1. Retrieve records that meet the conditions
Select * from tab where condition
2. Move the pointer to ($ page-1) * $ rpp
3. Display $ rpp records
======================= ============================================= ==+ =========
Number of records | scheme | times 1 2 3 4 5 6 7 8 9 0 | average | Efficiency Ratio
======================= ============================================= ==+ =========
| Page 1 2, 1, 1, 2, 1, 1, 2, 2, 1, 2 | 1.3 |
| 1 + ---------------------------------------------- + ------ + 1.6 |
10000 records | Other pages 2, 2, 2, 3, 1, 1, 2, 2, 2 | 1.9 | 4.8125