Re: Oracle row limit support (again)
| From: | John Lim | Date: | Fri, 30 Nov 2001 14:37:34 +0000 |
| Subject: | Re: Oracle row limit support (again) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-3234@lists.php.net to get a copy of this message | ||
Hi Tomas,
This is wonderful. This is what I like and admire - simple brilliant
solutions. No parsing of the column names!
Regards, John
PS: My algorithm for ADOdb's SelectLimit( ) will be something like this
in the future...
if $offset < 100 then
### hmm, few rows, so no need to execute 2 SQL select's
select * from ($sql)
else
### use Tomas algorithm (provided he doesn't patent it
### and asks for royalties !)
endif
Tomas V.V.Cox <cox@idecnet.com> wrote in message
news:3C06EA19.3472D091@idecnet.com...
> 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? ;-)