Home >Backend Development >PHP Tutorial >Comparative test of two schemes of Php+MySql paging mechanism_PHP tutorial

Comparative test of two schemes of Php+MySql paging mechanism_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:02:28954browse

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

http://www.bkjia.com/PHPjc/631068.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631068.htmlTechArticleHardware environment: PIII550,128M,15.2G Software environment: Win98+Apache+Php4+MySql Solution 1: 1. When querying for the first time, use Select count(1) from tab where condition to get the number of records that meet the condition $...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn