good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re:(Zigster) (OT) Improving a SQL JOIN statementby zigster (Hermit) |
on Apr 10, 2001 at 17:48 UTC ( [id://71324]=note: print w/replies, xml ) | Need Help?? |
If you have a primary key then the join should be fully qualified. The main reason for slow joins is poor qualification. Do you have to have a DISTINCT in your sql? If so then your join qualification is not complete. You should look to be able to linke each row with exactly one other on the other table. If you have a primary key (and use this as a foriegn key all will be well. Unfortunatly without a lot more information it is difficult to know what to suggest.
Suffice to say that with the data volumes you are suggesting a two table join should return witnin seconds not minutes so you are right to optimise. Try getting some SQL analysis software and run your sql throught it. Look for full table scans. Look in your sql for clauses that will defeat the indexes. Do you use TOUPPER LIKE or any similar sql. Rememeber it is all well having indexes only if the database can use them.
I HTH
In Section
Seekers of Perl Wisdom
|
|