Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7856

EXPLAIN FORMAT=JSON should show partitions

    XMLWordPrintable

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))"
          }
        }
      }

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.