Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: which method is more faster?

by Hercynium (Hermit)
on Jul 25, 2007 at 17:23 UTC ( [id://628735]=note: print w/replies, xml ) Need Help??


in reply to Re: which method is more faster?
in thread which method is more faster?

My understanding is that Perl extracts the hash keys into a list in-memory when you use the keys operator (function?).

When I know I'll be working with large hashes like this, I tend to use each, so the key/value pairs are fetched from the hash one-at-a-time.

If you're using lots of memory, give this a try:
my $dbh=DBI->connect("xxxx"); # My DB is SQLSERVER 2005 my $sth=$dbh->prepare(qq{ UPDATE tab SET d=? WHERE id=?}); for (my ($key,$val) = each %hash) { $sth->execute($hash{$key},$val); } $sth->finish; $dbh->disconnect;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-24 06:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found