From 9ae95a4aaa18ba8fa32963356608a482318701ac Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 20 Aug 2018 21:41:12 -0600 Subject: [PATCH 1/3] Update explain format for TiDB 2.1 In TiDB 2.1 the EXPLAIN output format changes. --- sql/understanding-the-query-execution-plan.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sql/understanding-the-query-execution-plan.md b/sql/understanding-the-query-execution-plan.md index 51a7c5b803d43..896ad095e5870 100644 --- a/sql/understanding-the-query-execution-plan.md +++ b/sql/understanding-the-query-execution-plan.md @@ -20,16 +20,14 @@ The results of `EXPLAIN` shed light on how to index the data tables so that the ## `EXPLAIN` output format -Currently, the `EXPLAIN` statement returns the following six columns: id, parent, children, task, operator info, and count. Each operator in the execution plan is described by the six properties. In the results returned by `EXPLAIN`, each row describes an operator. See the following table for details: +Currently, the `EXPLAIN` statement returns the following four columns: id, count, task, operator info. Each operator in the execution plan is described by the four properties. In the results returned by `EXPLAIN`, each row describes an operator. See the following table for details: | Property Name | Description | | -----| ------------- | -| id | The id of an operator, to identify the uniqueness of an operator in the entire execution plan. | -| parent | The parent of an operator. The current execution plan is like a tree structure composed of operators. The data flows from a child to its parent, and each operator has one and only one parent. | -| children | the children and the data source of an operator | +| id | The id of an operator, to identify the uniqueness of an operator in the entire execution plan. As of TiDB 2.1, the id includes formatting to show a tree structure of operators. The data flows from a child to its parent, and each operator has one and only one parent. | +| count | An estimation of the number of data items that the current operator outputs, based on the statistics and the execution logic of the operator | | task | the task that the current operator belongs to. The current execution plan contains two types of tasks: 1) the **root** task that runs on the TiDB server; 2) the **cop** task that runs concurrently on the TiKV server. The topological relations of the current execution plan in the task level is that a root task can be followed by many cop tasks. The root task uses the output of cop task as the input. The cop task executes the tasks that TiDB pushes to TiKV. Each cop task scatters in the TiKV cluster and is executed by multiple processes. | | operator info | The details about each operator. The information of each operator differs from others, see [Operator Info](#operator-info).| -| count | to predict the number of data items that the current operator outputs, based on the statistics and the execution logic of the operator | ## Overview From a0914259024762e21395b500f9fa349d5dfcba93 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 20 Aug 2018 21:49:03 -0600 Subject: [PATCH 2/3] Fixed an existing typo --- sql/understanding-the-query-execution-plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/understanding-the-query-execution-plan.md b/sql/understanding-the-query-execution-plan.md index 896ad095e5870..f39174611b3f1 100644 --- a/sql/understanding-the-query-execution-plan.md +++ b/sql/understanding-the-query-execution-plan.md @@ -14,7 +14,7 @@ The result of the `EXPLAIN` statement provides information about how TiDB execut - `EXPLAIN` works together with `SELECT`, `DELETE`, `INSERT`, `REPLACE`, and `UPDATE`. - When you run the `EXPLAIN` statement, TiDB returns the final physical execution plan which is optimized by the SQL statment of `EXPLAIN`. In other words, `EXPLAIN` displays the complete information about how TiDB executes the SQL statement, such as in which order, how tables are joined, and what the expression tree looks like. For more information, see [`EXPLAIN` output format](#explain-output-format). -- TiDB dose not support `EXPLAIN [options] FOR CONNECTION connection_id` currently. We'll do it in the future. For more information, see [#4351](https://github.com/pingcap/tidb/issues/4351). +- TiDB does not support `EXPLAIN [options] FOR CONNECTION connection_id` currently. We'll do it in the future. For more information, see [#4351](https://github.com/pingcap/tidb/issues/4351). The results of `EXPLAIN` shed light on how to index the data tables so that the execution plan can use the index to speed up the execution of SQL statements. You can also use `EXPLAIN` to check if the optimizer chooses the optimal order to join tables. From 05ae8798da7f9ce41af3b877712028c43617b302 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Wed, 22 Aug 2018 06:55:25 -0600 Subject: [PATCH 3/3] Address PR Feedback --- sql/understanding-the-query-execution-plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/understanding-the-query-execution-plan.md b/sql/understanding-the-query-execution-plan.md index f39174611b3f1..39a29d93e2a18 100644 --- a/sql/understanding-the-query-execution-plan.md +++ b/sql/understanding-the-query-execution-plan.md @@ -24,7 +24,7 @@ Currently, the `EXPLAIN` statement returns the following four columns: id, count | Property Name | Description | | -----| ------------- | -| id | The id of an operator, to identify the uniqueness of an operator in the entire execution plan. As of TiDB 2.1, the id includes formatting to show a tree structure of operators. The data flows from a child to its parent, and each operator has one and only one parent. | +| id | The id of an operator, to identify the uniqueness of an operator in the entire execution plan. As of TiDB 2.1, the id includes formatting to show a tree structure of operators. The data flows from a child to its parent, and each operator has one and only one parent. | | count | An estimation of the number of data items that the current operator outputs, based on the statistics and the execution logic of the operator | | task | the task that the current operator belongs to. The current execution plan contains two types of tasks: 1) the **root** task that runs on the TiDB server; 2) the **cop** task that runs concurrently on the TiKV server. The topological relations of the current execution plan in the task level is that a root task can be followed by many cop tasks. The root task uses the output of cop task as the input. The cop task executes the tasks that TiDB pushes to TiKV. Each cop task scatters in the TiKV cluster and is executed by multiple processes. | | operator info | The details about each operator. The information of each operator differs from others, see [Operator Info](#operator-info).|