From 31a916acf4f7c2bddb41c8e9db50286f50351002 Mon Sep 17 00:00:00 2001 From: wjhuang2016 Date: Wed, 3 Jun 2020 14:21:14 +0800 Subject: [PATCH 01/12] init Signed-off-by: wjhuang2016 --- .../system-table-information-schema.md | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 6adfe7cad7a1..9583f9540b98 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -32,6 +32,16 @@ select * from `ANALYZE_STATUS`; 6 rows in set ``` +`ANALYZE_STATUS` 表中列的含义如下: + +* `TABLE_SCHEMA`: 表所属的数据库的名称。 +* `TABLE_NAME`: 表的名称。 +* `PARTITION_NAME`: 分区表的名称。 +* `JOB_INFO`: 任务信息。 +* `PROCESSED_ROWS`: 进程数量。 +* `START_TIME`: 开始时间。 +* `STATE`: 状态。 + ## CHARACTER_SETS 表 `CHARACTER_SETS` 表提供[字符集](/character-set-and-collation.md)相关的信息。TiDB 目前仅支持部分字符集。 @@ -548,6 +558,27 @@ desc statistics; +---------------+---------------+------+------+---------+-------+ ``` +`TIDB_INDEXES` 表中列的含义如下: + +* `TABLE_CATALOG`: 包含索引的表所属的目录的名称。这个值总是 `def`。 +* `TABLE_SCHEMA`: 包含索引的表所属的数据库的名称。 +* `TABLE_NAME`: 包含索引的表的名称。 +* `NON_UNIQUE`: 如果索引不能包含重复项,则为 `0`;如果可以,则为 `1`。 +* `INDEX_SCHEMA`: 索引所属的数据库的名称。 +* `INDEX_NAME`: 索引的名称。如果索引是主键,那么名称总是 `PRIMARY`。 +* `SEQ_IN_INDEX`: 索引中的列序号,从1开始。 +* `COLUMN_NAME`: 列名。请参见表达式列的说明。 +* `COLLATION`: 列在索引中的排序方式。它可以有值 `A` (升序)、`D` (降序)或 `NULL` (未排序)。 +* `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,运行 `ANALYZE TABLE`。 +* `SUB_PART`: 索引的前缀。如果只对列的部分前缀索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 +* `PACKED`: TiDB 未使用该字段。这个值总是 `NULL`。 +* `NULLABLE`: 如果列可能包含空值,则值为 `YES`;如果不包含,则值为 `''`。 +* `INDEX_TYPE`: 索引的类型。 +* `COMMENT`: 索引没有在列中描述的信息。 +* `INDEX_COMMENT`: 在创建索引时为索引提供的带有注释属性的任何注释。 +* `IS_VISIBLE`: 优化器能否使用该索引。 +* `Expression` 对于非表达式部分的索引键,这个值为 `NULL`;对于表达式部分的索引键,这个值为表达式本身。可参考[表达式索引](/sql-statements/sql-statement-create-index.md/#表达式索引) + 下列语句是等价的: {{< copyable "sql" >}} @@ -687,10 +718,13 @@ CONSTRAINT_CATALOG: def CONSTRAINT_TYPE: UNIQUE ``` -其中: +`TABLE_CONSTRAINTS` 表中列的含义如下: -* `CONSTRAINT_TYPE` 的取值可以是 `UNIQUE`,`PRIMARY KEY`,或者 `FOREIGN KEY`。 -* `UNIQUE` 和 `PRIMARY KEY` 信息与 `SHOW INDEX` 语句的执行结果类似。 +* `CONSTRAINT_CATALOG`: 约束所属的目录的名称。这个值总是 `def`。 +* `CONSTRAINT_SCHEMA`: 约束所属的数据库的名称。 +* `CONSTRAINT_NAME`: 约束的名称。 +* `TABLE_NAME`: 表的名称。 +* `CONSTRAINT_TYPE`: 约束的类型。取值可以是 `UNIQUE`,`PRIMARY KEY`,或者 `FOREIGN KEY`。UNIQUE` 和 `PRIMARY KEY` 信息与 `SHOW INDEX` 语句的执行结果类似。 ## TIDB_HOT_REGIONS 表 From d573d219f2b24a49426e30a51965993c87f08185 Mon Sep 17 00:00:00 2001 From: wjhuang2016 Date: Wed, 3 Jun 2020 14:26:25 +0800 Subject: [PATCH 02/12] fix Signed-off-by: wjhuang2016 --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 9583f9540b98..f92f54385b22 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -724,7 +724,7 @@ CONSTRAINT_CATALOG: def * `CONSTRAINT_SCHEMA`: 约束所属的数据库的名称。 * `CONSTRAINT_NAME`: 约束的名称。 * `TABLE_NAME`: 表的名称。 -* `CONSTRAINT_TYPE`: 约束的类型。取值可以是 `UNIQUE`,`PRIMARY KEY`,或者 `FOREIGN KEY`。UNIQUE` 和 `PRIMARY KEY` 信息与 `SHOW INDEX` 语句的执行结果类似。 +* `CONSTRAINT_TYPE`: 约束的类型。取值可以是 `UNIQUE`,`PRIMARY KEY`,或者 `FOREIGN KEY`。`UNIQUE` 和 `PRIMARY KEY` 信息与 `SHOW INDEX` 语句的执行结果类似。 ## TIDB_HOT_REGIONS 表 From 58d8034d03bce243de149cbbc09b3ff467f87ade Mon Sep 17 00:00:00 2001 From: wjhuang2016 Date: Wed, 3 Jun 2020 14:53:08 +0800 Subject: [PATCH 03/12] fix Signed-off-by: wjhuang2016 --- system-tables/system-table-information-schema.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index f92f54385b22..3ff4e1240eca 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -38,7 +38,7 @@ select * from `ANALYZE_STATUS`; * `TABLE_NAME`: 表的名称。 * `PARTITION_NAME`: 分区表的名称。 * `JOB_INFO`: 任务信息。 -* `PROCESSED_ROWS`: 进程数量。 +* `PROCESSED_ROWS`: 已经处理的行数。 * `START_TIME`: 开始时间。 * `STATE`: 状态。 @@ -577,7 +577,7 @@ desc statistics; * `COMMENT`: 索引没有在列中描述的信息。 * `INDEX_COMMENT`: 在创建索引时为索引提供的带有注释属性的任何注释。 * `IS_VISIBLE`: 优化器能否使用该索引。 -* `Expression` 对于非表达式部分的索引键,这个值为 `NULL`;对于表达式部分的索引键,这个值为表达式本身。可参考[表达式索引](/sql-statements/sql-statement-create-index.md/#表达式索引) +* `Expression` 对于非表达式部分的索引键,这个值为 `NULL`;对于表达式部分的索引键,这个值为表达式本身。可参考[表达式索引](/sql-statements/sql-statement-create-index.md) 下列语句是等价的: From 59ee45d31a484cf571196c7054881cd94933d4d4 Mon Sep 17 00:00:00 2001 From: wjhuang2016 Date: Wed, 3 Jun 2020 14:55:12 +0800 Subject: [PATCH 04/12] fix Signed-off-by: wjhuang2016 --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 3ff4e1240eca..2809910feae5 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -577,7 +577,7 @@ desc statistics; * `COMMENT`: 索引没有在列中描述的信息。 * `INDEX_COMMENT`: 在创建索引时为索引提供的带有注释属性的任何注释。 * `IS_VISIBLE`: 优化器能否使用该索引。 -* `Expression` 对于非表达式部分的索引键,这个值为 `NULL`;对于表达式部分的索引键,这个值为表达式本身。可参考[表达式索引](/sql-statements/sql-statement-create-index.md) +* `Expression` 对于非表达式部分的索引键,这个值为 `NULL`;对于表达式部分的索引键,这个值为表达式本身。可参考[表达式索引](/sql-statements/sql-statement-create-index.md#表达式索引) 下列语句是等价的: From 0a4173b723f4cbc5f10f6abe1b1c6a8b9c73df0d Mon Sep 17 00:00:00 2001 From: wjHuang Date: Thu, 4 Jun 2020 17:17:19 +0800 Subject: [PATCH 05/12] Update system-table-information-schema.md --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 2809910feae5..6d34deb081d8 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -558,7 +558,7 @@ desc statistics; +---------------+---------------+------+------+---------+-------+ ``` -`TIDB_INDEXES` 表中列的含义如下: +`STATISTICS` 表中列的含义如下: * `TABLE_CATALOG`: 包含索引的表所属的目录的名称。这个值总是 `def`。 * `TABLE_SCHEMA`: 包含索引的表所属的数据库的名称。 From 8ec65ad4516b38bdfa601dec101fd623f2e4c650 Mon Sep 17 00:00:00 2001 From: wjHuang Date: Tue, 16 Jun 2020 14:45:57 +0800 Subject: [PATCH 06/12] Update system-tables/system-table-information-schema.md Co-authored-by: djshow832 --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 6d34deb081d8..3ea21070c9bf 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -566,7 +566,7 @@ desc statistics; * `NON_UNIQUE`: 如果索引不能包含重复项,则为 `0`;如果可以,则为 `1`。 * `INDEX_SCHEMA`: 索引所属的数据库的名称。 * `INDEX_NAME`: 索引的名称。如果索引是主键,那么名称总是 `PRIMARY`。 -* `SEQ_IN_INDEX`: 索引中的列序号,从1开始。 +* `SEQ_IN_INDEX`: 索引中的列序号,从 1 开始。 * `COLUMN_NAME`: 列名。请参见表达式列的说明。 * `COLLATION`: 列在索引中的排序方式。它可以有值 `A` (升序)、`D` (降序)或 `NULL` (未排序)。 * `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,运行 `ANALYZE TABLE`。 From b257b9ee3cce06fe4bd8ee4e8023a5dfcd0431ab Mon Sep 17 00:00:00 2001 From: wjHuang Date: Tue, 16 Jun 2020 14:48:22 +0800 Subject: [PATCH 07/12] Update system-tables/system-table-information-schema.md Co-authored-by: djshow832 --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 3ea21070c9bf..d7b536b0d688 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -572,7 +572,7 @@ desc statistics; * `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,运行 `ANALYZE TABLE`。 * `SUB_PART`: 索引的前缀。如果只对列的部分前缀索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 * `PACKED`: TiDB 未使用该字段。这个值总是 `NULL`。 -* `NULLABLE`: 如果列可能包含空值,则值为 `YES`;如果不包含,则值为 `''`。 +* `NULLABLE`: 如果列可能包含空值,则值为 `YES`;如果不包含,则值为 `''`。 * `INDEX_TYPE`: 索引的类型。 * `COMMENT`: 索引没有在列中描述的信息。 * `INDEX_COMMENT`: 在创建索引时为索引提供的带有注释属性的任何注释。 From 9fc6a3c9b05561a6a5d66cb94566e0a6c8206097 Mon Sep 17 00:00:00 2001 From: wjHuang Date: Tue, 16 Jun 2020 14:48:35 +0800 Subject: [PATCH 08/12] Update system-tables/system-table-information-schema.md Co-authored-by: djshow832 --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index d7b536b0d688..67479fc1ad7c 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -563,7 +563,7 @@ desc statistics; * `TABLE_CATALOG`: 包含索引的表所属的目录的名称。这个值总是 `def`。 * `TABLE_SCHEMA`: 包含索引的表所属的数据库的名称。 * `TABLE_NAME`: 包含索引的表的名称。 -* `NON_UNIQUE`: 如果索引不能包含重复项,则为 `0`;如果可以,则为 `1`。 +* `NON_UNIQUE`: 如果索引不能包含重复项,则为 `0`;如果可以,则为 `1`。 * `INDEX_SCHEMA`: 索引所属的数据库的名称。 * `INDEX_NAME`: 索引的名称。如果索引是主键,那么名称总是 `PRIMARY`。 * `SEQ_IN_INDEX`: 索引中的列序号,从 1 开始。 From ddf32f6a2bcfddecdcc983759f108c7db5e516b6 Mon Sep 17 00:00:00 2001 From: wjhuang2016 Date: Tue, 16 Jun 2020 15:03:22 +0800 Subject: [PATCH 09/12] fix Signed-off-by: wjhuang2016 --- system-tables/system-table-information-schema.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 67479fc1ad7c..d6ccf264241e 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -40,7 +40,7 @@ select * from `ANALYZE_STATUS`; * `JOB_INFO`: 任务信息。 * `PROCESSED_ROWS`: 已经处理的行数。 * `START_TIME`: 开始时间。 -* `STATE`: 状态。 +* `STATE`: 状态。包括 `padding`,`running`,`finished`和`failed`。 ## CHARACTER_SETS 表 @@ -570,11 +570,11 @@ desc statistics; * `COLUMN_NAME`: 列名。请参见表达式列的说明。 * `COLLATION`: 列在索引中的排序方式。它可以有值 `A` (升序)、`D` (降序)或 `NULL` (未排序)。 * `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,运行 `ANALYZE TABLE`。 -* `SUB_PART`: 索引的前缀。如果只对列的部分前缀索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 +* `SUB_PART`: 索引的前缀。如果只对列的部分前缀索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 * `PACKED`: TiDB 未使用该字段。这个值总是 `NULL`。 * `NULLABLE`: 如果列可能包含空值,则值为 `YES`;如果不包含,则值为 `''`。 * `INDEX_TYPE`: 索引的类型。 -* `COMMENT`: 索引没有在列中描述的信息。 +* `COMMENT`: 其他与索引有关的信息。 * `INDEX_COMMENT`: 在创建索引时为索引提供的带有注释属性的任何注释。 * `IS_VISIBLE`: 优化器能否使用该索引。 * `Expression` 对于非表达式部分的索引键,这个值为 `NULL`;对于表达式部分的索引键,这个值为表达式本身。可参考[表达式索引](/sql-statements/sql-statement-create-index.md#表达式索引) From 9b372283e6e07a7364533b8682d090be0c2db3dc Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 17 Jun 2020 19:23:35 +0800 Subject: [PATCH 10/12] Apply suggestions from code review --- system-tables/system-table-information-schema.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index fcf5a5333762..c065d240554a 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -40,7 +40,7 @@ select * from `ANALYZE_STATUS`; * `JOB_INFO`: 任务信息。 * `PROCESSED_ROWS`: 已经处理的行数。 * `START_TIME`: 开始时间。 -* `STATE`: 状态。包括 `padding`,`running`,`finished`和`failed`。 +* `STATE`: 状态。包括 `padding`、`running`、`finished` 和 `failed`。 ## CHARACTER_SETS 表 @@ -638,10 +638,10 @@ desc statistics; * `NON_UNIQUE`: 如果索引不能包含重复项,则为 `0`;如果可以,则为 `1`。 * `INDEX_SCHEMA`: 索引所属的数据库的名称。 * `INDEX_NAME`: 索引的名称。如果索引是主键,那么名称总是 `PRIMARY`。 -* `SEQ_IN_INDEX`: 索引中的列序号,从 1 开始。 +* `SEQ_IN_INDEX`: 索引中的列序号,从 `1` 开始。 * `COLUMN_NAME`: 列名。请参见表达式列的说明。 -* `COLLATION`: 列在索引中的排序方式。它可以有值 `A` (升序)、`D` (降序)或 `NULL` (未排序)。 -* `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,运行 `ANALYZE TABLE`。 +* `COLLATION`: 列在索引中的排序方式。取值可以是 `A`(升序)、`D`(降序)或 `NULL`(未排序)。 +* `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,执行 `ANALYZE TABLE`。 * `SUB_PART`: 索引的前缀。如果只对列的部分前缀索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 * `PACKED`: TiDB 未使用该字段。这个值总是 `NULL`。 * `NULLABLE`: 如果列可能包含空值,则值为 `YES`;如果不包含,则值为 `''`。 @@ -820,7 +820,7 @@ CONSTRAINT_CATALOG: def * `CONSTRAINT_SCHEMA`: 约束所属的数据库的名称。 * `CONSTRAINT_NAME`: 约束的名称。 * `TABLE_NAME`: 表的名称。 -* `CONSTRAINT_TYPE`: 约束的类型。取值可以是 `UNIQUE`,`PRIMARY KEY`,或者 `FOREIGN KEY`。`UNIQUE` 和 `PRIMARY KEY` 信息与 `SHOW INDEX` 语句的执行结果类似。 +* `CONSTRAINT_TYPE`: 约束的类型。取值可以是 `UNIQUE`、`PRIMARY KEY` 或者 `FOREIGN KEY`。`UNIQUE` 和 `PRIMARY KEY` 信息与 `SHOW INDEX` 语句的执行结果类似。 ## TIDB_HOT_REGIONS 表 From f14ee9cc16897cb7e841a93189b59d09ef2751e0 Mon Sep 17 00:00:00 2001 From: wjHuang Date: Wed, 17 Jun 2020 20:29:34 +0800 Subject: [PATCH 11/12] Update system-tables/system-table-information-schema.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index c065d240554a..81736f5c4b44 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -642,7 +642,7 @@ desc statistics; * `COLUMN_NAME`: 列名。请参见表达式列的说明。 * `COLLATION`: 列在索引中的排序方式。取值可以是 `A`(升序)、`D`(降序)或 `NULL`(未排序)。 * `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,执行 `ANALYZE TABLE`。 -* `SUB_PART`: 索引的前缀。如果只对列的部分前缀索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 +* `SUB_PART`: 索引的前缀。如果只对列的部分前缀进行索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 * `PACKED`: TiDB 未使用该字段。这个值总是 `NULL`。 * `NULLABLE`: 如果列可能包含空值,则值为 `YES`;如果不包含,则值为 `''`。 * `INDEX_TYPE`: 索引的类型。 From 52679f616dff6cb40349de8df9b853f36552244b Mon Sep 17 00:00:00 2001 From: wjHuang Date: Wed, 17 Jun 2020 20:29:42 +0800 Subject: [PATCH 12/12] Update system-tables/system-table-information-schema.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- system-tables/system-table-information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tables/system-table-information-schema.md b/system-tables/system-table-information-schema.md index 81736f5c4b44..ab9f63e178bc 100644 --- a/system-tables/system-table-information-schema.md +++ b/system-tables/system-table-information-schema.md @@ -644,7 +644,7 @@ desc statistics; * `CARDINALITY`: 索引中唯一值的数量的估计。要更新这个数字,执行 `ANALYZE TABLE`。 * `SUB_PART`: 索引的前缀。如果只对列的部分前缀进行索引,则为索引字符的数量;如果对整个列进行索引,则为 `NULL`。 * `PACKED`: TiDB 未使用该字段。这个值总是 `NULL`。 -* `NULLABLE`: 如果列可能包含空值,则值为 `YES`;如果不包含,则值为 `''`。 +* `NULLABLE`: 如果列可能包含 `NULL` 值,则值为 `YES`;如果不包含,则值为 `''`。 * `INDEX_TYPE`: 索引的类型。 * `COMMENT`: 其他与索引有关的信息。 * `INDEX_COMMENT`: 在创建索引时为索引提供的带有注释属性的任何注释。