MySQL Forums
Forum List  »  Knowledge Base

Re: SELECT from VIEW using joins uses indexes of not necessary left joined tables
Posted by: bbkr
Date: January 09, 2009 10:55AM

Even more trivial example (using data above) behaves incorrectly:

mysql> EXPLAIN SELECT foo_id FROM base LEFT JOIN bar USING (bar_id);
+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+-------------+
| 1 | SIMPLE | base | ALL | NULL | NULL | NULL | NULL | 4 | |
| 1 | SIMPLE | bar | eq_ref | PRIMARY | PRIMARY | 4 | getresponse_mig.base.bar_id | 1 | Using index |
+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+-------------+
2 rows in set (0.01 sec)


Why MySQL wants to perform join to bar? Does it change the result? No. It's completly unused.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: SELECT from VIEW using joins uses indexes of not necessary left joined tables
3155
January 09, 2009 10:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.