DBD::Pg behavior for large queries - Mailing list pgsql-general

From Chris
Subject DBD::Pg behavior for large queries
Date
Msg-id 9a0c82c6050118103830efaf6e@mail.gmail.com
Whole thread Raw
List pgsql-general
I'm using DBD::Pg under mod perl, and I'm trying to find a way to
workaround the fact that DBD::Pg fetches all the data at once in a
query and sticks it into memory before you execute a fetch.  Right now
I'm having to kill the apache child after it's finished running in
certain cases, and I'd rather not do that.

The DBD::Pg man page say's this about cursors.  What I don't
understand is the nested selects being in a different transactions.
Can someone clarify for me what is being said here?  Does this
basically mean that I can use cursors in DBD::Pg, I just can't use the
built in DBI cursor functions?  And If I'm reading this correctly you
can't do nested selects within cursors period?

"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!"


Chris

pgsql-general by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: Change type
Next
From: Christopher Browne
Date:
Subject: Re: What is xmin ?