Skip to content

Commit

Permalink
sql: fix two oncall issues (#15195)
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxsd authored Nov 3, 2023
1 parent 09e435a commit ba94975
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mysql-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,17 @@ Currently, the `help_topic` is NULL.
* `tidb_ttl_task`: the current ongoing TTL subtasks
* `tidb_ttl_job_history`: the execution history of TTL tasks in the last 90 days

## Runaway queries related system tables
## System tables related to runaway queries

* `tidb_runaway_queries`: the history records of all identified runaway queries in the past 7 days
* `tidb_runaway_watch`: the watch list of runaway queries
* `tidb_runaway_watch_done`: a watch list of deleted or expired runaway queries

## System tables related to metadata locks

* `tidb_mdl_view`:a view of metadata locks. You can use it to view information about the currently blocked DDL statements
* `tidb_mdl_info`:used internally by TiDB to synchronize metadata locks across nodes

## Miscellaneous system tables

<CustomContent platform="tidb">
Expand Down
25 changes: 25 additions & 0 deletions sql-statements/sql-statement-admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This statement is a TiDB extension syntax, used to view the status of TiDB and c
- [`ADMIN PLUGINS`](#admin-plugins-related-statement)
- [`ADMIN ... BINDINGS`](#admin-bindings-related-statement)
- [`ADMIN REPAIR`](#admin-repair-statement)
- [`ADMIN SHOW NEXT_ROW_ID`](#admin-show-next_row_id-statement)
- [`ADMIN SHOW SLOW`](#admin-show-slow-statement)

## DDL related statement
Expand Down Expand Up @@ -135,6 +136,14 @@ Here "untrusted" means that you need to manually ensure that the metadata of the

</CustomContent>

## `ADMIN SHOW NEXT_ROW_ID` statement

```sql
ADMIN SHOW t NEXT_ROW_ID;
```

The above statement is used to view the details of some special columns of a table. The output is the same as [SHOW TABLE NEXT_ROW_ID](/sql-statements/sql-statement-show-table-next-rowid.md).

## `ADMIN SHOW SLOW` statement

> **Note:**
Expand Down Expand Up @@ -211,6 +220,22 @@ ADMIN SHOW DDL JOBS 5;
+--------+---------+------------+---------------------+----------------+-----------+----------+-----------+-----------------------------------+-----------------------------------+---------------+
```

Run the following command to view the details of some special columns of a table. The output is the same as [SHOW TABLE NEXT_ROW_ID](/sql-statements/sql-statement-show-table-next-rowid.md).

```sql
ADMIN SHOW t NEXT_ROW_ID;
```

```sql
+---------+------------+-------------+--------------------+----------------+
| DB_NAME | TABLE_NAME | COLUMN_NAME | NEXT_GLOBAL_ROW_ID | ID_TYPE |
+---------+------------+-------------+--------------------+----------------+
| test | t | _tidb_rowid | 101 | _TIDB_ROWID |
| test | t | _tidb_rowid | 1 | AUTO_INCREMENT |
+---------+------------+-------------+--------------------+----------------+
2 rows in set (0.01 sec)
```

Run the following command to view the uncompleted DDL jobs in the test database. The results include the DDL jobs that are running and the last 5 DDL jobs that are completed but failed.

{{< copyable "sql" >}}
Expand Down

0 comments on commit ba94975

Please sign in to comment.