From 3b122d37584a287f0e9c25470fb8dcccc2d4ad0e Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 17 Jun 2020 14:11:29 +0800 Subject: [PATCH 1/6] sql-statement: update `admin` related statements --- sql-statements/sql-statement-admin.md | 116 ++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/sql-statements/sql-statement-admin.md b/sql-statements/sql-statement-admin.md index 2e4bfcb42221f..d535213a550de 100644 --- a/sql-statements/sql-statement-admin.md +++ b/sql-statements/sql-statement-admin.md @@ -9,6 +9,8 @@ aliases: ['/docs/dev/reference/sql/statements/admin/'] This statement is a TiDB extension syntax, used to view the status of TiDB and check the data of tables in TiDB. +## DDL Related ADMIN Extension Statement + To view the currently running DDL jobs, use `ADMIN SHOW DDL`: {{< copyable "sql" >}} @@ -54,6 +56,8 @@ If the operation fails to cancel the jobs, specific reasons are displayed. > - This operation can cancel multiple DDL jobs at the same time. You can get the ID of DDL jobs using the `ADMIN SHOW DDL JOBS` statement. > - If the jobs you want to cancel are finished, the cancellation operation fails. +## `ADMIN CHECK` related statement + To check the consistency of all the data and corresponding indexes in the `tbl_name` table, use `ADMIN CHECK TABLE`: {{< copyable "sql" >}} @@ -64,6 +68,102 @@ ADMIN CHECK TABLE tbl_name [, tbl_name] ...; If the consistency check is passed, an empty result is returned. Otherwise, an error message is returned indicating that the data is inconsistent. +{{< copyable "sql" >}} + +```sql +ADMIN CHECK INDEX tbl_name idx_name; +``` + +The above statement is used to check the consistency of the column data and index data corresponding to the' idx_name' index in the' tbl_name' table. If it passes the check, an empty query result will be returned; Otherwise, an error message with inconsistent data is returned. + +{{< copyable "sql" >}} + +```sql +ADMIN CHECK INDEX tbl_name idx_name (lower_val, upper_val) [, (lower_val, upper_val)] ...; +``` + +The above statement is used to check the consistency of the column data and index data corresponding to the' idx_name' index in the' tbl_name' table, and specifies the data range to be checked. If it passes the check, an empty query result will be returned; Otherwise, an error message with inconsistent data is returned. + +{{< copyable "sql" >}} + +```sql +ADMIN CHECKSUM TABLE tbl_name [, tbl_name] ...; +``` + +The above statement will obtain the 64-bit checksum value of tbl_name', which can be obtained by calculating CRC64 of all key value pairs (including row data and index data) in the table. + +## `ADMIN RELOAD` statement + +{{< copyable "sql" >}} + +```sql +ADMIN RELOAD expr_pushdown_blacklist; +``` + +The above statement is used to reload the blacklist pushed down by the expression. + +{{< copyable "sql" >}} + +```sql +ADMIN RELOAD opt_rule_blacklist; +``` + +The above statement is used to reload the blacklist of logic optimization rules. + +## `ADMIN PLUGINS` related statement + +{{< copyable "sql" >}} + +```sql +ADMIN PLUGINS ENABLE plugin_name [, plugin_name] ...; +``` + +The above statement is used to enable the `plugin_name` plugin. + +{{< copyable "sql" >}} + +```sql +ADMIN PLUGINS DISABLE plugin_name [, plugin_name] ...; +``` + +The above statement is used to disable the `plugin_name` plugin. + +## `ADMIN BINDINGS` related statement + +{{< copyable "sql" >}} + +```sql +ADMIN FLUSH bindings; +``` + +The above statement is used to persist SQL Plan binding information. + +{{< copyable "sql" >}} + +```sql +ADMIN CAPTURE bindings; +``` + +The above statement can generate the binding of SQL Plan from the `SELECT` statement that occurs more than once. + +{{< copyable "sql" >}} + +```sql +ADMIN EVOLVE bindings; +``` + +After the automatic binding function is turned on, the evolution of SQL Plan binding information is triggered every ` bind-info-leave` (default value is `3s`). The above statement is used to actively trigger this evolution. + +{{< copyable "sql" >}} + +```sql +ADMIN RELOAD bindings; +``` + +The above statement is used to reload SQL Plan binding information. + +## `ADMIN REPAIR` statement + To overwrite the metadata of the stored table in an untrusted way in extreme cases, use `ADMIN REPAIR TABLE`: {{< copyable "sql" >}} @@ -74,6 +174,22 @@ ADMIN REPAIR TABLE tbl_name CREATE TABLE STATEMENT; Here “untrusted” means that you need to manually ensure that the metadata of the original table can be covered by the `CREATE TABLE STATEMENT` operation. To use this `REPAIR` statement, enable the [`repair-mode`](/tidb-configuration-file.md#repair-mode) configuration item, and make sure that the tables to be repaired are listed in the [`repair-table-list`](/tidb-configuration-file.md#repair-table-list). +## `ADMIN SHOW SLOW` statement + +{{< copyable "sql" >}} + +```sql +ADMIN SHOW SLOW RECENT N; +``` + +{{< copyable "sql" >}} + +```sql +ADMIN SHOW SLOW TOP [INTERNAL | ALL] N; +``` + +For detailed usage, refer to [admin show slow statement] (/identify-slow-queues.md#admin-show-slow-command) + ## Synopsis **AdminStmt:** From 6b82fc83c5401deef52996e24fbca02120dafbb5 Mon Sep 17 00:00:00 2001 From: toutdesuite Date: Thu, 18 Jun 2020 23:26:26 +0800 Subject: [PATCH 2/6] Apply suggestions from code review --- sql-statements/sql-statement-admin.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sql-statements/sql-statement-admin.md b/sql-statements/sql-statement-admin.md index d535213a550de..359a0f885621a 100644 --- a/sql-statements/sql-statement-admin.md +++ b/sql-statements/sql-statement-admin.md @@ -9,7 +9,7 @@ aliases: ['/docs/dev/reference/sql/statements/admin/'] This statement is a TiDB extension syntax, used to view the status of TiDB and check the data of tables in TiDB. -## DDL Related ADMIN Extension Statement +## DDL related statement To view the currently running DDL jobs, use `ADMIN SHOW DDL`: @@ -74,7 +74,7 @@ If the consistency check is passed, an empty result is returned. Otherwise, an e ADMIN CHECK INDEX tbl_name idx_name; ``` -The above statement is used to check the consistency of the column data and index data corresponding to the' idx_name' index in the' tbl_name' table. If it passes the check, an empty query result will be returned; Otherwise, an error message with inconsistent data is returned. +The above statement is used to check the consistency of the column data and index data corresponding to the `idx_name` index in the `tbl_name` table. If the consistency check is passed, an empty result is returned; otherwise, an error message is returned indicating that the data is inconsistent. {{< copyable "sql" >}} @@ -82,7 +82,7 @@ The above statement is used to check the consistency of the column data and inde ADMIN CHECK INDEX tbl_name idx_name (lower_val, upper_val) [, (lower_val, upper_val)] ...; ``` -The above statement is used to check the consistency of the column data and index data corresponding to the' idx_name' index in the' tbl_name' table, and specifies the data range to be checked. If it passes the check, an empty query result will be returned; Otherwise, an error message with inconsistent data is returned. +The above statement is used to check the consistency of the column data and index data corresponding to the `idx_name` index in the `tbl_name` table, with the data range (to be checked) specified. If the consistency check is passed, an empty result is returned. Otherwise, an error message is returned indicating that the data is inconsistent. {{< copyable "sql" >}} @@ -90,7 +90,7 @@ The above statement is used to check the consistency of the column data and inde ADMIN CHECKSUM TABLE tbl_name [, tbl_name] ...; ``` -The above statement will obtain the 64-bit checksum value of tbl_name', which can be obtained by calculating CRC64 of all key value pairs (including row data and index data) in the table. +The above statement is used to get the 64-bit checksum value of `tbl_name'. This value is obtained by calculating CRC64 of all key value pairs (including row data and index data) in the table. ## `ADMIN RELOAD` statement @@ -152,7 +152,7 @@ The above statement can generate the binding of SQL Plan from the `SELECT` state ADMIN EVOLVE bindings; ``` -After the automatic binding function is turned on, the evolution of SQL Plan binding information is triggered every ` bind-info-leave` (default value is `3s`). The above statement is used to actively trigger this evolution. +After the automatic binding feature is enabled, the evolution of SQL Plan binding information is triggered every ` bind-info-leave` (the default value is `3s`). The above statement is used to proactively trigger this evolution. {{< copyable "sql" >}} @@ -188,7 +188,7 @@ ADMIN SHOW SLOW RECENT N; ADMIN SHOW SLOW TOP [INTERNAL | ALL] N; ``` -For detailed usage, refer to [admin show slow statement] (/identify-slow-queues.md#admin-show-slow-command) +For details, refer to [admin show slow statement](/identify-slow-queues.md#admin-show-slow-command) ## Synopsis From f7f97e2656b294713e237c2c92a6539226affe33 Mon Sep 17 00:00:00 2001 From: Lynn Date: Fri, 19 Jun 2020 11:27:56 +0800 Subject: [PATCH 3/6] sql-statements: make lint happy --- sql-statements/sql-statement-admin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-admin.md b/sql-statements/sql-statement-admin.md index 359a0f885621a..69d1bff2a2ea1 100644 --- a/sql-statements/sql-statement-admin.md +++ b/sql-statements/sql-statement-admin.md @@ -152,7 +152,7 @@ The above statement can generate the binding of SQL Plan from the `SELECT` state ADMIN EVOLVE bindings; ``` -After the automatic binding feature is enabled, the evolution of SQL Plan binding information is triggered every ` bind-info-leave` (the default value is `3s`). The above statement is used to proactively trigger this evolution. +After the automatic binding feature is enabled, the evolution of SQL Plan binding information is triggered every `bind-info-leave` (the default value is `3s`). The above statement is used to proactively trigger this evolution. {{< copyable "sql" >}} From 3fb0056fe725ca6edb209f665ec3dcd67d5c09f6 Mon Sep 17 00:00:00 2001 From: Keke Yi <40977455+yikeke@users.noreply.github.com> Date: Fri, 19 Jun 2020 13:53:16 +0800 Subject: [PATCH 4/6] fix a link --- sql-statements/sql-statement-admin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-admin.md b/sql-statements/sql-statement-admin.md index 69d1bff2a2ea1..1be5c4fc1a6b9 100644 --- a/sql-statements/sql-statement-admin.md +++ b/sql-statements/sql-statement-admin.md @@ -188,7 +188,7 @@ ADMIN SHOW SLOW RECENT N; ADMIN SHOW SLOW TOP [INTERNAL | ALL] N; ``` -For details, refer to [admin show slow statement](/identify-slow-queues.md#admin-show-slow-command) +For details, refer to [admin show slow statement](/identify-slow-queries.md#admin-show-slow-command) ## Synopsis From 0661aa257c5216312dca9c3376cf807956e7fa5c Mon Sep 17 00:00:00 2001 From: yikeke Date: Fri, 19 Jun 2020 14:04:35 +0800 Subject: [PATCH 5/6] add missing 3rd headers --- sql-statements/sql-statement-admin.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sql-statements/sql-statement-admin.md b/sql-statements/sql-statement-admin.md index 1be5c4fc1a6b9..6394bd1e4e95a 100644 --- a/sql-statements/sql-statement-admin.md +++ b/sql-statements/sql-statement-admin.md @@ -11,6 +11,8 @@ This statement is a TiDB extension syntax, used to view the status of TiDB and c ## DDL related statement +### `admin show DDL` + To view the currently running DDL jobs, use `ADMIN SHOW DDL`: {{< copyable "sql" >}} @@ -19,6 +21,8 @@ To view the currently running DDL jobs, use `ADMIN SHOW DDL`: ADMIN SHOW DDL; ``` +### `admin show DDL jobs` + To view all the results in the current DDL job queue (including tasks that are running and waiting to be run) and the last ten results in the completed DDL job queue, use `ADMIN SHOW DDL JOBS`: {{< copyable "sql" >}} @@ -30,6 +34,8 @@ ADMIN SHOW DDL JOBS [NUM] [WHERE where_condition]; * `NUM`: to view the last `NUM` results in the completed DDL job queue. If not specified, `NUM` is by default 10. * `WHERE`: to add filter conditions. +### `admin show DDL queries` + To view the original SQL statements of the DDL job corresponding to `job_id`, use `ADMIN SHOW DDL JOB QUERIES`: {{< copyable "sql" >}} @@ -40,6 +46,8 @@ ADMIN SHOW DDL JOB QUERIES job_id [, job_id] ...; You can only searches the running DDL job corresponding to `job_id` and the last ten results in the DDL history job queue. +### `admin cancel DDL jobs` + To cancel the currently running DDL jobs and return whether the corresponding jobs are successfully cancelled, use `ADMIN CANCEL DDL JOBS`: {{< copyable "sql" >}} @@ -84,6 +92,8 @@ ADMIN CHECK INDEX tbl_name idx_name (lower_val, upper_val) [, (lower_val, upper_ The above statement is used to check the consistency of the column data and index data corresponding to the `idx_name` index in the `tbl_name` table, with the data range (to be checked) specified. If the consistency check is passed, an empty result is returned. Otherwise, an error message is returned indicating that the data is inconsistent. +### `admin checksum` + {{< copyable "sql" >}} ```sql From 0bad06665b76ca491edef4df0bd938b3218d978c Mon Sep 17 00:00:00 2001 From: Keke Yi <40977455+yikeke@users.noreply.github.com> Date: Fri, 19 Jun 2020 14:24:06 +0800 Subject: [PATCH 6/6] fix format --- sql-statements/sql-statement-admin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-admin.md b/sql-statements/sql-statement-admin.md index 6394bd1e4e95a..6eae561cc5e28 100644 --- a/sql-statements/sql-statement-admin.md +++ b/sql-statements/sql-statement-admin.md @@ -100,7 +100,7 @@ The above statement is used to check the consistency of the column data and inde ADMIN CHECKSUM TABLE tbl_name [, tbl_name] ...; ``` -The above statement is used to get the 64-bit checksum value of `tbl_name'. This value is obtained by calculating CRC64 of all key value pairs (including row data and index data) in the table. +The above statement is used to get the 64-bit checksum value of `tbl_name`. This value is obtained by calculating CRC64 of all key-value pairs (including row data and index data) in the table. ## `ADMIN RELOAD` statement