Re: how to use Pager on an sql (Page pagination)
| From: | Lorenzo Alberton | Date: | Fri, 23 Jul 2004 08:52:41 +0000 |
| Subject: | Re: how to use Pager on an sql (Page pagination) | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13825@lists.php.net to get a copy of this message | ||
On Wed, 21 Jul 2004 16:08:38 +0200, Norbert Mocsnik wrote:
> What's the reason for not using
> http://pear.php.net/DB_Pager for
> database purposes?
DB_Pager will do an unlimited query, and will fetch only
the relevant records from the resultset, but if your dbms
doesn't support cursors, the resultset will cause quite a
big load over the network, especially if the db is not on
the same machine.
The Pager_Wrapper is designed to fetch a small, limited
resultset, so the network load is significantly smaller.
It will do one extra COUNT(*) query, but that's really fast.
I did some benchmarks with Apache AB some weeks ago,
they're attached.
If you need the scripts too, I'll send them.
Regards,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
> Louie Miranda wrote:
>> Good news!! :) im using it now!!
>>
>> have a look! :)
>>
>> http://www.cavitehub.com/gbook/
>>
>> well, Pager is really great! :),
thanks :)
>> it save's me a lot of time to do
>> those repeatative mysql task's.
>>
>> next thing i would do is try the wrapper.
/Apache2/bin>ab -n 50 -c 1 http://www.mysite.com/limit_query.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking xxxxxxxx (be patient).....done Server Software: Apache/1.3.27 Server Hostname: xxxxxxxxxxxxxx Server Port: 80 Document Path: /limit_query.php Document Length: 0 bytes Concurrency Level: 1 Time taken for tests: 22.218750 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 9100 bytes HTML transferred: 0 bytes Requests per second: 2.25 [#/sec] (mean) Time per request: 444.375 [ms] (mean) Time per request: 444.375 [ms] (mean, across all concurrent requests) Transfer rate: 0.36 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 4.1 0 15 Processing: 234 442 98.0 484 609 Waiting: 234 439 97.7 484 609 Total: 234 443 98.6 484 609 Percentage of the requests served within a certain time (ms) 50% 484 66% 484 75% 484 80% 484 90% 500 95% 500 98% 609 99% 609 100% 609 (longest request) ============================================================================ ============================================================================ /Apache2/bin>ab -n 50 -c 1 http://xxxxxxxxxxxxxx/full_query.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking xxxxxxxxxxxxxx (be patient).....done Server Software: Apache/1.3.27 Server Hostname: xxxxxxxxxxxxxx Server Port: 80 Document Path: /full_query.php Document Length: 0 bytes Concurrency Level: 1 Time taken for tests: 54.203125 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 9100 bytes HTML transferred: 0 bytes Requests per second: 0.92 [#/sec] (mean) Time per request: 1084.063 [ms] (mean) Time per request: 1084.063 [ms] (mean, across all concurrent requests) Transfer rate: 0.15 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 4 7.1 0 15 Processing: 812 1078 175.0 1062 1765 Waiting: 796 1076 176.2 1062 1765 Total: 812 1083 174.8 1062 1765 Percentage of the requests served within a certain time (ms) 50% 1062 66% 1093 75% 1109 80% 1140 90% 1234 95% 1312 98% 1765 99% 1765 100% 1765 (longest request) /Apache2/bin>ab -n 50 -c 1 http://localhost/pager/pear_db_pager.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.0.49 Server Hostname: localhost Server Port: 80 Document Path: /pager/pear_db_pager.php Document Length: 6984 bytes Concurrency Level: 1 Time taken for tests: 18.859375 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 358500 bytes HTML transferred: 349200 bytes Requests per second: 2.65 [#/sec] (mean) Time per request: 377.188 [ms] (mean) Time per request: 377.188 [ms] (mean, across all concurrent requests) Transfer rate: 18.56 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 3.7 0 15 Processing: 359 375 5.7 375 390 Waiting: 312 323 8.0 328 343 Total: 359 376 5.9 375 390 Percentage of the requests served within a certain time (ms) 50% 375 66% 375 75% 375 80% 375 90% 390 95% 390 98% 390 99% 390 100% 390 (longest request) =================================================================== =================================================================== /Apache2/bin>ab -n 50 -c 1 http://localhost/pager/pear_pager.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.0.49 Server Hostname: localhost Server Port: 80 Document Path: /pager/pear_pager.php Document Length: 1227 bytes Concurrency Level: 1 Time taken for tests: 12.328125 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 70650 bytes HTML transferred: 61350 bytes Requests per second: 4.06 [#/sec] (mean) Time per request: 246.563 [ms] (mean) Time per request: 246.563 [ms] (mean, across all concurrent requests) Transfer rate: 5.52 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 5.6 0 15 Processing: 31 243 100.5 296 297 Waiting: 31 237 100.2 281 296 Total: 31 245 99.5 296 312 Percentage of the requests served within a certain time (ms) 50% 296 66% 296 75% 296 80% 296 90% 296 95% 296 98% 312 99% 312 100% 312 (longest request) =================================================================== =================================================================== /Apache2/bin>ab -n 50 -c 1 http://localhost/pager/pear_pager.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.0.49 Server Hostname: localhost Server Port: 80 Document Path: /pager/pear_pager.php Document Length: 1227 bytes Concurrency Level: 1 Time taken for tests: 12.265625 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 70650 bytes HTML transferred: 61350 bytes Requests per second: 4.08 [#/sec] (mean) Time per request: 245.313 [ms] (mean) Time per request: 245.313 [ms] (mean, across all concurrent requests) Transfer rate: 5.54 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 5.3 0 15 Processing: 31 242 100.9 296 297 Waiting: 31 237 102.2 281 296 Total: 31 244 100.4 296 312 Percentage of the requests served within a certain time (ms) 50% 296 66% 296 75% 296 80% 296 90% 296 95% 296 98% 312 99% 312 100% 312 (longest request)
/Apache2/bin>ab -n 50 -c 1 http://www.mysite.com/limit_query.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking xxxxxxxx (be patient).....done Server Software: Apache/1.3.27 Server Hostname: xxxxxxxxxxxxxx Server Port: 80 Document Path: /limit_query.php Document Length: 0 bytes Concurrency Level: 1 Time taken for tests: 22.218750 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 9100 bytes HTML transferred: 0 bytes Requests per second: 2.25 [#/sec] (mean) Time per request: 444.375 [ms] (mean) Time per request: 444.375 [ms] (mean, across all concurrent requests) Transfer rate: 0.36 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 4.1 0 15 Processing: 234 442 98.0 484 609 Waiting: 234 439 97.7 484 609 Total: 234 443 98.6 484 609 Percentage of the requests served within a certain time (ms) 50% 484 66% 484 75% 484 80% 484 90% 500 95% 500 98% 609 99% 609 100% 609 (longest request) ============================================================================ ============================================================================ /Apache2/bin>ab -n 50 -c 1 http://xxxxxxxxxxxxxx/full_query.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking xxxxxxxxxxxxxx (be patient).....done Server Software: Apache/1.3.27 Server Hostname: xxxxxxxxxxxxxx Server Port: 80 Document Path: /full_query.php Document Length: 0 bytes Concurrency Level: 1 Time taken for tests: 54.203125 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 9100 bytes HTML transferred: 0 bytes Requests per second: 0.92 [#/sec] (mean) Time per request: 1084.063 [ms] (mean) Time per request: 1084.063 [ms] (mean, across all concurrent requests) Transfer rate: 0.15 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 4 7.1 0 15 Processing: 812 1078 175.0 1062 1765 Waiting: 796 1076 176.2 1062 1765 Total: 812 1083 174.8 1062 1765 Percentage of the requests served within a certain time (ms) 50% 1062 66% 1093 75% 1109 80% 1140 90% 1234 95% 1312 98% 1765 99% 1765 100% 1765 (longest request) /Apache2/bin>ab -n 50 -c 1 http://localhost/pager/pear_db_pager.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.0.49 Server Hostname: localhost Server Port: 80 Document Path: /pager/pear_db_pager.php Document Length: 6984 bytes Concurrency Level: 1 Time taken for tests: 18.859375 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 358500 bytes HTML transferred: 349200 bytes Requests per second: 2.65 [#/sec] (mean) Time per request: 377.188 [ms] (mean) Time per request: 377.188 [ms] (mean, across all concurrent requests) Transfer rate: 18.56 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 3.7 0 15 Processing: 359 375 5.7 375 390 Waiting: 312 323 8.0 328 343 Total: 359 376 5.9 375 390 Percentage of the requests served within a certain time (ms) 50% 375 66% 375 75% 375 80% 375 90% 390 95% 390 98% 390 99% 390 100% 390 (longest request) =================================================================== =================================================================== /Apache2/bin>ab -n 50 -c 1 http://localhost/pager/pear_pager.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.0.49 Server Hostname: localhost Server Port: 80 Document Path: /pager/pear_pager.php Document Length: 1227 bytes Concurrency Level: 1 Time taken for tests: 12.328125 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 70650 bytes HTML transferred: 61350 bytes Requests per second: 4.06 [#/sec] (mean) Time per request: 246.563 [ms] (mean) Time per request: 246.563 [ms] (mean, across all concurrent requests) Transfer rate: 5.52 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 5.6 0 15 Processing: 31 243 100.5 296 297 Waiting: 31 237 100.2 281 296 Total: 31 245 99.5 296 312 Percentage of the requests served within a certain time (ms) 50% 296 66% 296 75% 296 80% 296 90% 296 95% 296 98% 312 99% 312 100% 312 (longest request) =================================================================== =================================================================== /Apache2/bin>ab -n 50 -c 1 http://localhost/pager/pear_pager.php This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.0.49 Server Hostname: localhost Server Port: 80 Document Path: /pager/pear_pager.php Document Length: 1227 bytes Concurrency Level: 1 Time taken for tests: 12.265625 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 70650 bytes HTML transferred: 61350 bytes Requests per second: 4.08 [#/sec] (mean) Time per request: 245.313 [ms] (mean) Time per request: 245.313 [ms] (mean, across all concurrent requests) Transfer rate: 5.54 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 5.3 0 15 Processing: 31 242 100.9 296 297 Waiting: 31 237 102.2 281 296 Total: 31 244 100.4 296 312 Percentage of the requests served within a certain time (ms) 50% 296 66% 296 75% 296 80% 296 90% 296 95% 296 98% 312 99% 312 100% 312 (longest request)