This is probably 50% an SQL question, and 50% a Perl question, but hopefully the monks will forgive me for my impurity :).
I am trying to execute the following loop to update a Postgresql table:
for (1..$#{$columns}) {
$sth = $dbh->prepare("UPDATE yeast1 set $tables[$_] = temp/$tables[$_
+-1] where yeast1.orf = temp.orf; INSERT INTO profile_index VALUES ('$
+tables[$_-1]', '$columns->[$_]')");
$sth->execute;
$sth = $dbh->prepare("UPDATE yeast1 set $tables[$_-1] = 999 where $ta
+bles[$_-1] IS NULL");
$sth->execute;
}
Yeast1 is a large table: 6265 rows and about 100 columns so far, and growing to about 400. This loop presently takes hours to complete, and gets longer as I load more data into yeast1. Does anyone know how I can optimize this DBI query? thanks, Evan
$sth = $dbh->prepare("UPDATE yeast1 set $tables
$_-1 = 999
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.