> >The corollary to the above quote is that MySQL can not use indexes
with
> >an OR clause at the base level.
> >
> MySQL *does* use the index on a different server, though, it just
> doesn't use the index on that server.  Compare the results of EXPLAIN
> queries on the two servers (after ANALYZE TABLE was run):
[Steven Roussey] 

Yes, I retract my corollary. MySQL can not use indexes on an OR clause
if there is no common prefix to the same index. It can have base level
OR and use an index but only if all the clauses in the OR use the same
index (specificly some prefix of the index). My bad. Always read the
manual -- its better than me!

[The situation that could be optimized in MySQL for some future TODO is
the case where you would be asking it to use multiple indexes for the
query.]

However, my guess is that either you need to run analyze on the other
table on the other server, or that it is returning too many rows, so
MySQL does a table scan because it determines it is faster. Indeed the
EXPLAIN tends to bear that out.

Are the tables defined the same on both servers? Is the data the same?
Is the query the same? Are both analyzed?
 




---------------------------------------------------------------------
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