List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:September 27 2003 1:11am
Subject:Re: Can someone explain the difference between these two queries?
View as plain text  
In the last episode (Sep 26), David Griffiths said:
> ----- Original Message -----
> From: "Mike R. Duncan" <miked@stripped>
> To: "Director General: NEFACOMP" <dg@stripped>;
> <myodbc@stripped>; <mysql@stripped>
> Sent: Thursday, September 25, 2003 2:55 PM
> Subject: RE: Ideas on creating connections

Please don't hijack threads.

[ snip 2 queries ]
> 
> The first one takes 1.73 seconds, the other takes 0.34 seconds.
> 
> The only difference is the order of the tables (address_list comes
> last in the FROM clause in the first example, and is in the middle of
> the FROM clause in the second example)...

What does an EXPLAIN SELECT .. on both queries print?  LEFT JOINs
definitely impose a table order, and it's possible MySQL is incorrectly
ordering other joins on those tables.  You didn't mention what version
of MySQL you are using, btw.
 
-- 
	Dan Nelson
	dnelson@stripped
Thread
RE: Ideas on creating connectionsDan Greene25 Sep
RE: Ideas on creating connectionsMike R. Duncan26 Sep