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

EXPLAIN FORMAT=JSON should show partitions

    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

            Hide
            psergey Sergei Petrunia added a comment -

            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.

            Show
            psergey Sergei Petrunia added a comment - 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.
            Hide
            sanja Oleksandr Byelkin added a comment -

            revision-id: c081073446c943f043d4bd6fa7d8e7785dd1d74f
            parent(s): 0df8c0aa5ed1a6d3869783a30cbe71521cffa4e4
            committer: Oleksandr Byelkin
            branch nick: server
            timestamp: 2015-04-08 10:13:36 +0200
            message:

            MDEV-7856: EXPLAIN FORMAT=JSON should show partitions

            Show
            sanja Oleksandr Byelkin added a comment - revision-id: c081073446c943f043d4bd6fa7d8e7785dd1d74f parent(s): 0df8c0aa5ed1a6d3869783a30cbe71521cffa4e4 committer: Oleksandr Byelkin branch nick: server timestamp: 2015-04-08 10:13:36 +0200 message: MDEV-7856 : EXPLAIN FORMAT=JSON should show partitions —
            Hide
            psergey Sergei Petrunia added a comment -

            Review feedback provided over email. This needs fixes.

            Show
            psergey Sergei Petrunia added a comment - Review feedback provided over email. This needs fixes.
            Hide
            sanja Oleksandr Byelkin added a comment -

            revision-id: 86a2a1f8675bcfa09a974dc63aed8f68866c07a8
            parent(s): 0df8c0aa5ed1a6d3869783a30cbe71521cffa4e4
            committer: Oleksandr Byelkin
            branch nick: server
            timestamp: 2015-04-09 11:15:01 +0200
            message:

            MDEV-7856: EXPLAIN FORMAT=JSON should show partitions

            Show
            sanja Oleksandr Byelkin added a comment - revision-id: 86a2a1f8675bcfa09a974dc63aed8f68866c07a8 parent(s): 0df8c0aa5ed1a6d3869783a30cbe71521cffa4e4 committer: Oleksandr Byelkin branch nick: server timestamp: 2015-04-09 11:15:01 +0200 message: MDEV-7856 : EXPLAIN FORMAT=JSON should show partitions —

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                psergey Sergei Petrunia
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: