Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
Take this testcase from subselect.test:
CREATE TABLE t1 ( a INT ); |
INSERT INTO t1 VALUES (1),(5); |
|
# t2 must be MyISAM or Aria and contain 1 row |
CREATE TABLE t2 ( b INT ) ENGINE=MyISAM; |
INSERT INTO t2 VALUES (1); |
|
CREATE TABLE t3 ( c INT ); |
INSERT INTO t3 VALUES (4),(5); |
|
SET optimizer_switch='subquery_cache=off'; |
|
SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; |
and run EXPLAIN FORMAT=JSON for the last query:
mysql> explain format=json SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1\G |
*************************** 1. row ***************************
|
EXPLAIN: {
|
"query_block": { |
"select_id": 1, |
"table": { |
"table_name": "t1", |
"access_type": "ALL", |
"rows": 2, |
"filtered": 100 |
},
|
"subqueries": [ |
{
|
"query_block": { |
"select_id": 2, |
"table": { |
"table_name": "t2", |
"access_type": "system", |
"rows": 1, |
"filtered": 100 |
},
|
"subqueries": [ |
{
|
"query_block": { |
"select_id": 3, |
"table": { |
"table_name": "t3", |
"access_type": "ALL", |
"rows": 2, |
"filtered": 100, |
"attached_condition": "1 = t3.c" |
}
|
}
|
}
|
]
|
}
|
}
|
]
|
}
|
}
|
One can see that the subquery is present but it is not clear where it is attached to?