>What am I doing wrong?
>
>The goal is to count the number of entries which match the account
>preferences.
>
>The results are correct, but the times are so far off...
>
>mysql> select count(*) from STLOUIS left join ClientSTL
> -> on STLOUIS.Dwell=ClientSTL.Dwell where ClientSTL.account='pruitt';
>
>+----------+
>| count(*) |
>+----------+
>| 63 |
>+----------+
>1 row in set (33.28 sec)
>
>mysql> select count(*) from STLOUIS where Dwell='Con';
>+----------+
>| count(*) |
>+----------+
>| 63 |
>+----------+
>1 row in set (0.01 sec)
Sir, the left join returns all rows from the left table, which means
that it doesn't use any indices on that table. The WHERE condition
ensures that rows that don't match on the right table aren't
returned, so the left join is unnecessary. Change it to an INNER
JOIN, and make sure you have proper indices on both tables.
Bob Hall
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
---------------------------------------------------------------------
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