Hi,

Table order can definitely make a difference in the order that MySQL
actually reads them. Like if MySQL *thinks* the cost to join 2 different
tables is equal, it will use the one that's listed first, first. But if
you know the cost is different and change the table order, it can help
the optimizer. STRAIGHT JOIN can be used in extreme cases where the
optimizer doesn't read the tables in the best order even though you've
listed them that way.


Matt


----- Original Message -----
From: "Dan Nelson"
Sent: Friday, September 26, 2003 8:11 PM
Subject: Re: Can someone explain the difference between these two
queries?


> In the last episode (Sep 26), David Griffiths said:
> > ----- Original Message -----
> > From: "Mike R. Duncan"
> > 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.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to