Bug #12106 | EXPLAIN shows incorrect select_type for subquery | ||
---|---|---|---|
Submitted: | 22 Jul 2005 8:40 | Modified: | 29 Mar 2006 13:38 |
Reporter: | Valeriy Kravchuk | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 4.1.12a-nt, 5.0.9-beta-nt | OS: | Windows (XP) |
Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[22 Jul 2005 8:40]
Valeriy Kravchuk
[2 Aug 2005 14:43]
Tony Deigh
I think the problem is a bit deeper than just the label. If you add primary keys to Valeriy's test case: create table t1 (c integer primary key); create table t2 (c integer primary key); note that the explain shows an index scan on the outer table. This makes the performance of the query far worse than the key look-up it should be using. +----+--------------------+-------+-----------------+---------------+---------+---------+------+------+--------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+--------------------+-------+-----------------+---------------+---------+---------+------+------+--------------------------+ | 1 | PRIMARY | t1 | index | NULL | PRIMARY | 4 | NULL | 0 | Using where; Using index | | 2 | DEPENDENT SUBQUERY | t2 | unique_subquery | PRIMARY | PRIMARY | 4 | func | 1 | Using index | +----+--------------------+-------+-----------------+---------------+---------+---------+------+------+--------------------------+
[7 Jan 2006 21:12]
Olaf van der Spek
Are there any updates on this bug? The issue is still present in 5.0.18 and it severely degrades the performance of these queries.
[29 Mar 2006 13:38]
Ramil Kalimullin
It's not a bug, this is how such subqueries are implemented now. Use 'explain extended...', then 'show warnings' to see what's happening. We have a corresponding task in the our todo list.