Home » questions » Optimize a simple MySQL query running slow because of an "OR" in the WHERE clause?
Optimize a simple MySQL query running slow because of an "OR" in the WHERE clause?
SELECT * FROM mytable WHERE field1="test" OR field2="test" limit 1;
This takes two seconds to run (vs. 0.00 for each search separately), and it refuses to use any index, even with FORCE INDEX. I would like to be able to run one search instead of two, and this seems very basic, but I can't find any info on how to do this! Please help me, MySQL gurus!

Answers
weida
On 2006-08-13 00:04:36
David La Pierre
On 2006-08-11 13:25:07