Demaestro - 10:08 pm on Sep 10, 2010 (gmt 0)
I have always been under the impression that using UNION is faster and can be considered optimized if you use it over a bunch of OR statements.
SELECT * FROM tableA, tableB WHERE tableA.field1 = tableB.field2
SELECT * FROM tableA, tableB WHERE tableA.field3 = tableB.field4
Is faster than this:
SELECT * FROM tableA, tableB WHERE tableA.field1 = tableB.field2 or tableA.field3 = tableB.field4
As LIA said, make sure you have properly indexed your fields. Also, if you don't need to return all columns then change * to just the fields you need, that will also help speed things up.