DBD::Pg behavior for large queries

From: Chris <pglist(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: DBD::Pg behavior for large queries
Date: 2005-01-18 18:38:24
Message-ID: 9a0c82c6050118103830efaf6e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vladimir S. Petukhov 2005-01-18 19:01:45 Change type
Previous Message Oleg Bartunov 2005-01-18 18:25:34 Re: Change type