in reply to Posgres batch read with DBI?
Perhaps something like:
while($row = shift(@$rowcache) || shift(@{$rowcache=$sth->fetchall_arr +ayref(undef, $max_rows)})) { ... } [download]