matshyeq wrote:
> The only solution is CURSOR based which I find an awkward low level hack
> comparing to elegant option supported by native library.
That's not the only solution, even with the current DBD::Pg
you could do:
$dbh->do("COPY (sql-squery) TO STDOUT");
my $data;
while ($dbh->pg_getcopydata($data) >= 0) {
# process $data
}
The results would be streamed as opposed to being accumulated in
memory. Also COPY is optimized for high performance.
The drawback is you'd have to parse $data according to the
specific rules of the COPY format, which may be easy or
not-so-easy depending on the actual data, numeric or text
or other, whether it has NULLs, backslashes and so on.
Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org