MySQL Forums
Forum List  »  Optimizer & Parser

Re: Optimizing a UNION Query
Posted by: Toa Sty
Date: August 24, 2006 05:28AM

Just thinking about it a bit more, you don't need to use subselects for this really.


Does this do what you want? Is it faster?

SELECT DISTINCT d1.docid FROM glossary g1, docref d1, glossary g2, docref d2, docIndex di
WHERE
g1.termid=d1.termid AND g1.word IN ('apple','orange','banana')
AND
g2.termid=d2.termid AND g2.word IN ('red','blue','green')
AND
d1.docid = di.docid AND d2.docid = di.docid;

Options: ReplyQuote


Subject
Views
Written By
Posted
6195
August 23, 2006 08:16PM
2646
August 24, 2006 04:59AM
Re: Optimizing a UNION Query
2663
August 24, 2006 05:28AM
2712
August 24, 2006 12:12PM
5389
August 25, 2006 06:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.