Did you try a straight join so MySQL won't swap the order of the tables?

Philip Smolen wrote:

>Right.  The simple example listed at the bottom of this message works great
>under version 4.  Version 3 gave the right answer, but it was very slow.
>That made me upgrade to version 4.
>
>However, even with version 4, I run into the same problem as soon as I add a
>join.  MySQL always wants to find an index to match the join conditions.  If
>there isn't an appropriate index, it actually sorts the data to match join
>conditions!  This is probably right in the general case, but it makes my
>query run very slowly.  How can I make this run faster?
>
>SELECT *
>FROM huge_table,small_table
>WHERE huge_table.field2 = small_table.field2
>ORDER BY huge_table.field1 DESC
>LIMIT 5;
>
>I want MySQL to use the index on huge_table.field1, just like it does when
>there is no join.
>



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