Skip to content

Commit

Permalink
sql-statements: update claims on optimizer/explain compatibility (#6695
Browse files Browse the repository at this point in the history
…) (#7296)
  • Loading branch information
ti-chi-bot authored Dec 20, 2021
1 parent e0b39b5 commit 7dcaf94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mysql-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ TiDB uses a combination of [Prometheus and Grafana](/tidb-monitoring-api.md) to

### Query Execution Plan

The output format, output content, and the privilege setting of Query Execution Plan (`EXPLAIN`/`EXPLAIN FOR`) in TiDB is greatly different from those in MySQL. See [Understand the Query Execution Plan](/explain-overview.md) for more details.
The output format, output content, and the privilege setting of Query Execution Plan (`EXPLAIN`/`EXPLAIN FOR`) in TiDB is greatly different from those in MySQL.

The MySQL system variable `optimizer_switch` is read-only in TiDB and has no effect on query plans. You can also use [optimizer hints](/optimizer-hints.md) in similar syntax to MySQL, but the available hints and implementation might differ.

See [Understand the Query Execution Plan](/explain-overview.md) for more details.

### Built-in functions

Expand Down
4 changes: 2 additions & 2 deletions sql-statements/sql-statement-explain.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ If the `dot` program is not installed on your computer, copy the result to [this
## MySQL compatibility

* Both the format of `EXPLAIN` and the potential execution plans in TiDB differ substaintially from MySQL.
* TiDB does not support the `EXPLAIN FORMAT=JSON` as in MySQL.
* TiDB does not support the `FORMAT=JSON` or `FORMAT=TREE` options.
* TiDB does not currently support `EXPLAIN` for insert statements.

## `EXPLAIN FOR CONNECTION`
### `EXPLAIN FOR CONNECTION`

`EXPLAIN FOR CONNECTION` is used to get the execution plan of the currently executed SQL query or the last executed SQL query in a connection. The output format is the same as that of `EXPLAIN`. However, the implementation of `EXPLAIN FOR CONNECTION` in TiDB is different from that in MySQL. Their differences (apart from the output format) are listed as follows:

Expand Down

0 comments on commit 7dcaf94

Please sign in to comment.