Home >Backend Development >PHP Tutorial >Comparative test of two schemes of Php+MySql paging mechanism_PHP tutorial
Hardware environment: PIII550, 128M, 15.2G
Software environment: Win98+Apache+Php4+MySql
Option 1:
1. Use Select count(1) from tab where condition to obtain satisfaction when querying for the first time The number of records in the condition $rows
2. Retrieve the record set through the number of previous pages $page and the number of records per page $rpp
select * from tab where condition limit ($page-1)*$rpp,$rpp
3. Display all records in the returned record set.
4. Pass $rows to subsequent pages when the page is transferred.
Option 2:
1. Retrieve the record set that meets the condition
select * from tab where condition
2. Move the pointer to ($page-1)*$rpp
3. Display $rpp records
==============+======+======================== =========================+======+======+========
Number of records | Plans | Times 1 2 3 4 4 5 6 7 8 9 0 | Average | Average | Efficiency ratio
==============+======+= =============================================+==== ==+======+========
🎜> -+------+ 1.6 |
10000 records| Other pages 2, 2, 2, 3, 1, 1, 2, 2, 2, 2 | 1.9 | | 4.8125