[MDEV-5524] Fix "Subqueries: n" in EXPLAIN for condition pushdown Created: 2014-01-13  Updated: 2015-11-17

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 1
Labels: optimizer

Issue Links:
PartOf
is part of MDEV-83 Cost-based choice for the pushdown of... Stalled

 Description   

(This has been previously discussed with Timour, I'm just filing the task now)

Currently, EXPLAIN shows subqueries like this:

create table ten(a int);
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int) as select a as a, a as b from ten;
 
mysql> explain select * from ten where a > (select max(b) from t1 where t1.b <= ten.a);
+------+--------------------+-------+------+---------------+------+---------+------+------+----------------------------+
| id   | select_type        | table | type | possible_keys | key  | key_len | ref  | rows | Extra                      |
+------+--------------------+-------+------+---------------+------+---------+------+------+----------------------------+
|    1 | PRIMARY            | ten   | ALL  | NULL          | NULL | NULL    | NULL |   10 | Using where; Subqueries: 2 |
|    2 | DEPENDENT SUBQUERY | t1    | ALL  | NULL          | NULL | NULL    | NULL |   10 | Using where                |
+------+--------------------+-------+------+---------------+------+---------+------+------+----------------------------+

This is not user-friendly, "Subqueries: 2" reads as if there were two
subqueries attached, while actually it is one subquery #2 that is attached.

Tentative new syntax:

  Subquery #n
  Subquery #n1, #n2


Generated at Thu Feb 08 07:05:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.