Hi,
Thanks for the reply.

> Hve you read
>
http://www.mysql.com/documentation/mysql/bychapter/manual_Performance.html#L
EFT_JOIN_optimization
> ?

Yes, many times, as well as just about everything else in the Performance
chapter. Am I missing something totally obvious? Should I even be using a
LEFT JOIN for my purpose?

Any why does using two separate queries execute much faster than one query?

0.03 sec:
SELECT files.id, dirs.name FROM files LEFT JOIN dirs ON files.dir_id=dirs.id
ORDER BY files.date DESC LIMIT 1;

0.00 sec + 0.00 sec:
SELECT id, dir_id FROM files ORDER BY date DESC LIMIT 1;
SELECT name FROM dirs WHERE id=<dir_id from last query>;

Later I want to use a LIMIT of 100 or more so I don't think using the
multiple queries will be an option then...

Jordan Russell


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