http://qs321.pair.com?node_id=274128


in reply to Re: Re: Speeding up the DBI
in thread Speeding up the DBI

I had been under the impression that cursors don't work through DBD::Pg. I'm mistaken?

Replies are listed 'Best First'.
Re: Re: Re: Re: Speeding up the DBI
by tantarbobus (Hermit) on Jul 14, 2003 at 20:04 UTC
    $dbh->do(q{DECLARE imprecator CURSOR FOR SELECT * FROM tablename}) ; my $number = 10; my $fetch = $dbh->prepare(q{FETCH $number FROM imprecator}); ## ### Fetch first $number * 10 rows. ## while ($fetch->execute()) { Data::Dumper::Dumper($fetch->fetchall_arrayref()); last if $fetch->rows() < $number; }
    Note: The code above has not been tested; it is for illustrative purposes only.