Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: DBI: How to update 150K records efficiently

by moritz (Cardinal)
on Mar 31, 2008 at 14:10 UTC ( #677524=note: print w/replies, xml ) Need Help??


in reply to DBI: How to update 150K records efficiently

If you haven't benchmarked it yet, try this:
my $sth = $dbh->prepare('UPDATE myTable SET va = ?, vb = ? WHERE vc = +?'); while (my $record = <$input>){ my @values = (split(/\|/,$record))[1,3,5]; $sth->execute(@values); } $sth->finish()

At least it avoids generating hashes for everything, and it uses a cached "prepared statement".

Replies are listed 'Best First'.
Re^2: DBI: How to update 150K records efficiently
by Juerd (Abbot) on Mar 31, 2008 at 15:16 UTC

    Oh, but the OP's code also uses a cached prepared statement. DBIx::Simple handles this internally. The problem is that before it can access the cache, it has to generate the query string all over :)

    Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://677524]
help
Chatterbox?
[Corion]: Oooh - LLVM support, that sounds nice. And also scary because that means an easier avenue to create and exploit machine-runnable code from (badly parsed, buffer-overwriting ) SQL ;)
[erix]: yeah, interesting one. I think it can speed up some queries nicely (I haven't played with it much yet)
[erix]: alas, sometimes it slow things down (it isn't enabled by default)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2018-05-24 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?