EXPLAIN FORMAT=JSON

You are viewing an old version of this article. View the current version here.
MariaDB starting with 10.1.2

Starting from version 10.1.2, MariaDB supports the EXPLAIN FORMAT=JSON syntax.

Synopsis

EXPLAIN FORMAT=JSON is a variant of EXPLAIN command that produces output in JSON form. The output always has one row which has only one column titled "JSON". The content is a JSON representation of query plan, formatted for readability:

MariaDB [test]> EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE col1=1\G
*************************** 1. row ***************************
EXPLAIN: {
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "t1",
      "access_type": "ALL",
      "rows": 1000,
      "filtered": 100,
      "attached_condition": "(t1.col1 = 1)"
    }
  }
}

MariaDB's output for EXPLAIN FORMAT=JSON is different from MySQL's. There are multiple reasons for that

  • MySQL's output has deficiencies (some are listed here: EXPLAIN FORMAT=JSON in MySQL)
  • MariaDB has optimizations that MySQL does not have. Ergo, MariaDB generates query plans that MySQL does not generate.

EXPLAIN FORMAT=JSON output

[not yet complete] EXPLAIN FORMAT=JSON differences from MySQL.

TODO: Our separate EXPLAIN FORMAT=JSON docs.

See also

  • ANALYZE FORMAT=JSON produces output like EXPLAIN FORMAT=JSON, but amended with the data from query execution.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.