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


in reply to Speeding up the DBI

I found a nice article here.
Basically, you want large sets not in an arrayref, but as a hash, since it's more clear what column holds the data.
e.g.
# tested this on live data, this is twice as fast as fetchrow_hashref, + and has the same advantage.. # example taken from the link above. my @fields = (qw(emp_id first_name monthly_payment)); $sth->execute; my %rec =(); $sth->bind_columns(map {\$rec{$_}} @fields); print "$rec{emp_id}\t", "$rec{first_name}\t", "$rec{monthly_payment}\n" while $sth->fetchrow_arrayref;
*Update*
Hmm, Funny indeed, anyway, i still consider this as a valuable way to speed up the DBI. :-)

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Replies are listed 'Best First'.
Re^2: Speeding up the DBI
by cchampion (Curate) on Jun 09, 2005 at 10:22 UTC

    Now that was quite funny. :-)

    You are quoting to gmax from an article that he has written (in case you didn't realize it, the article says that it was originally published as DBI recipes.)