Hi all,


I have a problem whith a very simple query.
My problem is: it doesn't use indexes. It does full table scans instead.
The only way I found to make it fast was using UNION.
Can somebody please tell me,
how I can make it fast (using indexes) without using UNION?


My query:
 SELECT * FROM mytable WHERE fielda=1 OR fieldb=2

 -The colums fielda and fieldb are offcourse indexed.
 -The table has about half a million rows.


Faster is:
  SELECT * FROM mytable WHERE fielda=1 UNION SELECT * FROM mytable WHERE
fieldb=2


Is there a way to make this fast on mysql 3.x as well?


thanks in advance
Gunnar

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to