in reply to speedy update routine
Both routines would be improved by reducing or eliminating global variables, and passing subroutines all the parameters they need. It would help to go through the exercise of converting your script to run under strict.
The first version would be improved by preparing a statement handle once, using placeholders,
The improvement here is not only in performance, but also in the safety of the DBI quoting mechanism invoked by the placeholders.my $sth = $dbh->prepare( q(UPDATE url_table SET hits=? WHERE url=?)); while (my ($url, $hits) = each %urlhits_update) { $sth->execute($hits, $url); # ... }
You won't be able to LOAD FILE from an in-memory file you've constructed. That would require a) A db server which can do so, and b) shared memory between the server and your perl process. Neither is likely.
Is 0.26 seconds really too slow?
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: speedy update routine
by js1 (Monk) on Jun 12, 2004 at 21:48 UTC | |
by Zaxo (Archbishop) on Jun 12, 2004 at 22:17 UTC |