Details
Description
EXPLAIN FORMAT=JSON does not print HAVING.
Testcase (not necessarily minimal):
create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1(a int); insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; create table t2 ( a int, b int, key (a) ); insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
Now, the test query:
explain format=json select a, max(b) as TOP from t2 group by a having TOP > a\G
*************************** 1. row ***************************
EXPLAIN: {
"query_block": {
"select_id": 1,
"table": {
"table_name": "t2",
"access_type": "index",
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"rows": 10443,
"filtered": 100
}
}
}
HAVING is not printed. GROUP BY is not printed, either, but it's a topic of another issue.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
MySQL 5.6 doesn't print it either:
MySQL [j5]> explain format=json select a, max(b) as TOP from t2 group by a having TOP > a\G *************************** 1. row *************************** EXPLAIN: { "query_block": { "select_id": 1, "grouping_operation": { "using_filesort": false, "table": { "table_name": "t2", "access_type": "index", "possible_keys": [ "a" ], "key": "a", "used_key_parts": [ "a" ], "key_length": "5", "rows": 10157, "filtered": 100 } } } }