Bad monk. Don't ill-advice. The OP uses the fastest way to fetch data. Your change would lose all speed:
$ cat test.pl use 5.16.2; use Benchmark qw(:hireswallclock cmpthese); use DBI; my $dbh = DBI->connect (); sub bindc { my $sth = $dbh->prepare ("select * from url"); $sth->execute; my %url; $sth->bind_columns (\@url{@{$sth->{NAME_lc}}}); my $n = 0; while ($sth->fetch) { $n++ } return $n; } # bindc sub ftchh { my $sth = $dbh->prepare ("select * from url"); $sth->execute; my %url; my $n = 0; while (my $ref = $sth->fetchrow_hashref) { $n++ } return $n; } # bindc say "url has ", bindc (), " records"; say "url has ", ftchh (), " records"; cmpthese (10, { bind_columns => \&bindc, fetch_hashref => \&ftchh, }); $ perl test.pl url has 491826 records url has 491826 records s/iter fetch_hashref bind_columns fetch_hashref 1.72 -- -87% bind_columns 0.224 670% -- $
In reply to Re^2: DBI and bind_columns issue
by Tux
in thread DBI and bind_columns issue
by nelgin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |