List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:September 18 2002 1:23pm
Subject:Re: Forcing a sort order in a join
View as plain text  
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?
>FROM huge_table,small_table
>WHERE huge_table.field2 = small_table.field2
>ORDER BY huge_table.field1 DESC
>I want MySQL to use the index on huge_table.field1, just like it does when
>there is no join.

Forcing a sort order in a joinPhilip Smolen14 Sep
  • Re: Forcing a sort order in a joinGerald Clark17 Sep
  • Re: Forcing a sort order in a joinPhilip Smolen18 Sep
  • Re: Forcing a sort order in a joinGerald Clark18 Sep