Hello.

You missed to mention that using LEFT JOIN changes the meaning of the
SELECT in question and it may also be a lot slower, dependend on the
data.

I think STRAIGHT_JOIN is more appropriate to force the tables to be
read in a certain order.

Bye,

        Benjamin.


On Mon 2002-06-03 at 14:26:21 -0400, [EMAIL PROTECTED] wrote:
> On 3 Jun 2002, at 11:49, Stembridge, Michael wrote:
> 
> >  FROM 
> >   call_notes, 
> >   call_notes_text, 
> >   users, 
> >   facility_contact 
> >  WHERE 
> >   call_notes.ticketid = '1' && 
> >   call_notes.userid = users.userid && 
> >   call_notes.contactid = facility_contact.contactid && 
> >   call_notes_text.noteid = call_notes.noteid 
> 
> I've found that LEFT JOIN can be useful in getting MySQL to process 
> tables in the best order.  (It also can make problems with your 
> tables more obvious, if records are missing from one of the joined 
> tables.)  Try changing that to 
> 
>    FROM call_notes c LEFT JOIN call_notes_text ct
>         ON c.noteid = ct.noteid
>         LEFT JOIN users u ON c.userid = u.userid
>         LEFT JOIN facility_contact f
>         ON c.contactid = f.contactid
>    WHERE c.ticketid = 1
> 
> and see how your EXPLAIN result changes.
[...]

[EMAIL PROTECTED]

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