James MacLean wrote: >On Thu, 1 Aug 2002, Ralf Narozny wrote: > > > >>Hello! >> >>James MacLean wrote: >> >> >> >>>Hi Folks, >>>Have only known enough SQL to do what we needed. >>>Today on mysql-3.23.51 we found out that : >>>select something from table where index1 = 'value' or index2 = 'value'; >>>Runs considerably slower than: >>>select something from table where index1 = 'value'; >>>or >>>select something from table where index2 = 'value'; >>> >>> >>Does it have a compund index, created like this: >>CREATE INDEX myindex ON table (index1,index2); >> >>??? >>Greetings >> Ralf >> >> > >Just tried that and it almost doubled my time again (to over 1sec) :(. > >Thanks for the idea though :), welcome any more :), >JES > > Hello,
According to MySQL documentation, indexes are not used with OR: http://www.mysql.com/doc/M/y/MySQL_indexes.html You can't speed up your query by adding indexes. Running 2 separate queries is the best you can do if you want to go fast. Regards -- Joseph Bueno NetClub/Trader.com --------------------------------------------------------------------- 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