Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Speeding up the DBI

by jbrugger (Parson)
on Jun 09, 2005 at 10:06 UTC ( [id://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.
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.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-18 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found