Hi Guys,
I have 2 queries:
select * FROM kcs_threadgroups AS t1, kcs_threads AS t2 WHERE
t2.manufacturer='DMC' AND t1.thread_index=t2.id ORDER BY t2.type,
t1.groupName
Using the explain command (explain select.) I get:
+-------+--------+---------------+---------+---------+-----------------+
------+---------------------------------+
| table | type | possible_keys | key | key_len | ref |
rows | Extra |
+-------+--------+---------------+---------+---------+-----------------+
------+---------------------------------+
| t1 | ALL | NULL | NULL | NULL | NULL |
286 | Using temporary; Using filesort |
| t2 | eq_ref | PRIMARY | PRIMARY | 4 | t1.thread_index |
1 | where used |
+-------+--------+---------------+---------+---------+-----------------+
------+---------------------------------+
select * FROM kcs_threadgroups AS t1, kcs_threads AS t2 WHERE
t2.manufacturer='DMC' AND t1.threadType=t2.type ORDER BY t2.type,
t1.groupName
Using the explain command I get:
+-------+------+---------------+------+---------+------+------+---------
------------------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra
|
+-------+------+---------------+------+---------+------+------+---------
------------------------+
| t1 | ALL | NULL | NULL | NULL | NULL | 286 | Using
temporary; Using filesort |
| t2 | ALL | NULL | NULL | NULL | NULL | 2067 | where
used |
+-------+------+---------------+------+---------+------+------+---------
------------------------+
With the second query, I am getting over 77,000 results returned and
with the first query I am getting 2067 - the correct amount.
The only differences between the 2 is that in the first I have WHERE
clause t1.thread_index=t2.id and in the second I have
t1.threadType=t2.type
I need to have the WHERE like the second query but for the life of my I
have no clue why it is returning over 77,000 results.
Can anyone help guide me to get the results of #1 but with the WHERE of
#2?
Thanks so much!
Aaron