From df965467780eb4bcaa565582ebf8ed23e2948c56 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Fri, 29 Oct 2021 10:44:29 -0600 Subject: [PATCH 1/3] sql-statements: update claims on explain compatibility --- sql-statements/sql-statement-explain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-statements/sql-statement-explain.md b/sql-statements/sql-statement-explain.md index 23738f042e524..52da246b059f1 100644 --- a/sql-statements/sql-statement-explain.md +++ b/sql-statements/sql-statement-explain.md @@ -244,10 +244,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: From 9e31a91ddf8f7b0980ba28ea52de36ad806366e1 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Fri, 29 Oct 2021 10:57:20 -0600 Subject: [PATCH 2/3] Add additional notes on optimizer --- mysql-compatibility.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-compatibility.md b/mysql-compatibility.md index 3058b1c8a303e..e170aa2ccc305 100644 --- a/mysql-compatibility.md +++ b/mysql-compatibility.md @@ -82,7 +82,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 `optimizer_switch` system variable is read-only in TiDB and has no effect on query plans. [Optimizer Hints](/optimizer-hints.md) are supported using 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 From d44f95f291344bba7e5fa822441890b4c480db58 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Fri, 17 Dec 2021 08:24:31 -0600 Subject: [PATCH 3/3] Update mysql-compatibility.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- mysql-compatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-compatibility.md b/mysql-compatibility.md index e170aa2ccc305..d4690c27c5234 100644 --- a/mysql-compatibility.md +++ b/mysql-compatibility.md @@ -84,7 +84,7 @@ TiDB uses a combination of [Prometheus and Grafana](/tidb-monitoring-api.md) to 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 `optimizer_switch` system variable is read-only in TiDB and has no effect on query plans. [Optimizer Hints](/optimizer-hints.md) are supported using similar syntax to MySQL, but the available hints and implementation might differ. +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.