Optimizing query
I have a query which has multiple joins and i'm trying to find a way to optimize it. What is the best solution? Is there a software that can look at the query and make suggestions on what to do, what indexes need to be created? My query is below...
I have an index on the models (modelid) and manufacturers (mfrid) at the moment. But even then it takes about 30 seconds to complete.
Thanks for any help.
SELECT DISTINCT models.modelid, models.ModelName FROM class INNER J
OIN (manufacturers RIGHT JOIN (((crossref INNER JOIN (costco_skus RIGHT JOIN pat
riotpart_tbl ON costco_skus.Costco_SKUS = patriotpart_tbl.partnumber) ON crossre
f.CrossrefId = patriotpart_tbl.crossrefid) INNER JOIN OEMMemory ON crossref.Cros
srefId = oemmemory.CrossRefID) INNER JOIN models ON OEMMemory.ModelID = models.m
odelid) ON manufacturers.mfrid = models.mfrid) ON class.catid = models.catid WHE
RE (class.catid = ? AND manufacturers.mfrid = ? AND ((costco_skus.crossref) In (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))) ORDER BY models.modelname ASC