On Mon, 17 Jan 2005 17:46:17 -0800, Chris Ochs wrote:
> It looks like $r->child_terminate does what I need. In the case of
> Postgresql it eats the memory when you execute the query, regardless
> of whether you actually fetch any results.
That can be worked around, however. By using a cursor, you can specify
exactly how much data you want at a time:
$dbh->{AutoCommit}=0; # Cursors only work inside transactions
$dbh->do(q(
declare c cursor for
-- YOUR SELECT GOES HERE
for read only
));
my $sth=$dbh->prepare('fetch forward 100 from c'); # Adjust number to taste
do {
$sth->execute;
while(my $row=$sth->fetchrow_arrayref){
# YOUR NORMAL LOOP BODY GOES HERE
}
} while $sth->rows+0; # It will be '0E0' (0 but true) the last time
--
Peter Haworth [EMAIL PROTECTED]
"The trouble with emacs is that it is too big, and not everywhere.
Also, it keeps adding :wq! to the end of all my documents."
-- Redvers Davies