DBI

Brendon Oliver brendon.oliver at redsheriff.com
Fri Apr 2 14:59:23 CST 2004


> One further suggestion.
>
> LIMIT and OFFSET mean that you are doing a search EACH time. If that is
> slow you will be a very long time.

True.

> CURSORS is actually what you want.
>
> You open a CURSOR and store a SELECT
>
> You can then open it again and read a few more rows, come back later
> and read a few more rows...
>
> More efficient - also these ARE supported under Postgres AND MySQL :-)

Yes, but in the case of Postgres (don't know about MySQL as I've never
used it), CURSORs are still not supported / available via DBD::Pg.  From
the most recent version of the module I could find (v1.32, 25/02/2004):

"Although PostgreSQL has a cursor concept, it has not been used in the
current implementation. Cursors in PostgreSQL can only be used inside a
transaction block. Because only one transaction block at a time is
allowed, this would have implied the restriction, not to use any nested
SELECT statements. Hence the execute method fetches all data at once into
data structures located in the frontend application. This has to be
considered when selecting large amounts of data!"


Cheers,

- Brendon.



More information about the Melbourne-pm mailing list