Re: Optimizing (a=b and c=d) OR (e=f and g=h)
You would want a UNION and not a JOIN.
You can covnert that into a UNION
SELECT * FROM relationships WHERE (class1='News' AND id1=52)
UNION
SELECT * FROM relationships WHERE (class2='News' AND id2=52);
If you use MySQL 5, it has a merged index optimization which may help your original statement.
Subject
Views
Written By
Posted
3045
July 20, 2006 12:07PM
Re: Optimizing (a=b and c=d) OR (e=f and g=h)
1986
July 20, 2006 05:29PM
1955
July 20, 2006 10:09PM
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.