Skip to content

Commit

Permalink
sql: fix two oncall issues (#15195) (#15259)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Nov 3, 2023
1 parent f06d0f7 commit 26ddf3f
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 @@ -59,12 +59,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

- `GLOBAL_VARIABLES`: global system variable table
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 @@ -11,6 +11,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 @@ -134,6 +135,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

{{< copyable "sql" >}}
Expand Down Expand Up @@ -210,6 +219,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 26ddf3f

Please sign in to comment.