Details
Description
EXPLAIN FORMAT=JSON (and ANALYZE FORMAT=JSON too) do not show used partitions.
create table ten(a int); insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t10 ( a int not null ) partition by key(a); insert into t10 select a from ten; explain partitions select * from t10 where a in (2,3,4);
EXPLAIN PARTITIONS shows:
MariaDB [j2]> explain partitions select * from t10 where a in (2,3,4); +------+-------------+-------+------------+------+---------------+------+---------+------+------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | Extra | +------+-------------+-------+------------+------+---------------+------+---------+------+------+-------------+ | 1 | SIMPLE | t10 | p0 | ALL | NULL | NULL | NULL | NULL | 10 | Using where | +------+-------------+-------+------------+------+---------------+------+---------+------+------+-------------+
EXPLAIN FORMAT=JSON doesn't show partitions:
MariaDB [j2]> explain format=json select * from t10 where a in (2,3,4)\G
*************************** 1. row ***************************
EXPLAIN: {
"query_block": {
"select_id": 1,
"table": {
"table_name": "t10",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "(t10.a in (2,3,4))"
}
}
}
For comparison, MySQL 5.6 shows:
MySQL [test]> explain format=json select * from t10 where a in (2,3,4)\G
*************************** 1. row ***************************
EXPLAIN: {
"query_block": {
"select_id": 1,
"table": {
"table_name": "t10",
"partitions": [
"p0"
],
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "(`test`.`t10`.`a` in (2,3,4))"
}
}
}
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
This should be fixed in the same way as it is solved for "possible_keys". The idea of that solution is that we save enough data so that we don't rely on table being when we're printing the JSON output.