Oracle row limit support (again)
| From: | Tomas V.V.Cox | Date: | Fri, 30 Nov 2001 02:08:25 +0000 |
| Subject: | Oracle row limit support (again) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-3211@lists.php.net to get a copy of this message | ||
Well, finally I thought in a better solution for the problem. Instead of
breaking my head with the SQL parser and trying to guess the resultant
columns for building the special query needed by the limit stuff, I used
a nice trick: launch the real query but with a special clausule (WHERE
NULL = NULL) that won't return anything execept the field names I need.
I haven't more time to test that with many queries, but looks good and I
think it should work with any query.
The results are impressive according to my benchmarks:
Bench info:
P233MMX - Linux - Oracle 8.0.5 - PHP cgi 4.1
Table with 10.000 rows
Always fetching 20 rows from the start position.
No average calculation, taken the first results returned
Leyend:
OUT (Throwing out the data until Oracle reachs the correct position)
PDB (Using the PEAR DB Oracle row limit)
From = 0
PDB: 0.019351
OUT: 0.011932
From = 1000
PDB: 0.025988
OUT: 1.191379
From = 5000
PDB: 0.016395
OUT: 5.539404
From = 9500
PDB: 0.023285
OUT: 11.037733
Tomas V.V.Cox
PD.- John, perhaps you want to add this to your benchmarks? ;-)