Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
As you can see the mySQL query is in a perl script. I need to do to separate queries to get all of the data I needmy $orf_id = $pt->get("$i,2"); $dbh->do(q{ CREATE TEMPORARY TABLE IF NOT EXISTS moo(id INT UNSIGNED, +escore DOUBLE, org_id MEDIUMINT)}); $sql1 = q{ INSERT INTO moo #First of two staements to get all hits for orf SELECT id2, escore, org_id2 FROM blast, protein WHERE id1 = id AND text_id = ? }; $sth2 = $dbh->prepare($sql1); $sth2->execute($orf_id); $sql1 = q{ INSERT INTO moo # Second of two statements to get all hits for orf SELECT id1, escore, org_id1 FROM blast, protein WHERE id2 = id AND text_id = ? }; $sth2 = $dbh->prepare($sql1); $sth2->execute($orf_id); $sql1 = q{ SELECT DISTINCT min(escore) as escore, org_id # Get min(escore) for each org = Main results FROM moo GROUP BY org_id };
edited by ybiC: balanced <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: speeding up mySQL query in .pm
by perrin (Chancellor) on Aug 14, 2003 at 19:31 UTC | |
|
Re: speeding up mySQL query in .pm
by monktim (Friar) on Aug 14, 2003 at 19:15 UTC | |
by bean (Monk) on Aug 14, 2003 at 21:08 UTC | |
by monktim (Friar) on Aug 15, 2003 at 13:46 UTC | |
by Anonymous Monk on Aug 14, 2003 at 21:36 UTC | |
by Apocalypse (Initiate) on Aug 16, 2003 at 07:08 UTC | |
|
Re: speeding up mySQL query in .pm
by esh (Pilgrim) on Aug 14, 2003 at 21:19 UTC |