Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Speeding up the DBI

by jbrugger (Parson)
on Jun 09, 2005 at 10:06 UTC ( #465041=note: print w/replies, xml ) Need Help??

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.
# 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;
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.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://465041]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2021-06-17 03:33 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (82 votes). Check out past polls.