in reply to Improving on MS-SQL over DBI and DBD::ODBC

fetchrow_hashref is known to be the slowest way to fetch rows. I like this example from the DBI docs when there could be alot of rows:
$sth->execute; my %row; $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } )); while ($sth->fetch) { print "$row{region}: $row{sales}\n"; }

Replies are listed 'Best First'.
Re^2: Improving on MS-SQL over DBI and DBD::ODBC
by radiantmatrix (Parson) on Nov 24, 2004 at 19:04 UTC

    Hm... I will have to analyze this. I often work with 60k+ row counts. Thank you!


    radiantmatrix
    require General::Disclaimer;
    Perl is

      The number of rows won't matter, this loops over the rows individually, just as fetchrow_hashref() does. The difference is that bind_cols() takes away some of the hash-creation overhead. The DBI docs unambiguously state that it is faster than fetchrow_hashref().