diff --git a/docs/reference/sql/information-schema/region-peers.md b/docs/reference/sql/information-schema/region-peers.md index ca786f9a8..ab22a7035 100644 --- a/docs/reference/sql/information-schema/region-peers.md +++ b/docs/reference/sql/information-schema/region-peers.md @@ -19,21 +19,27 @@ DESC REGION_PEERS; The output is as follows: ```sql -+--------------+--------+------+------+---------+---------------+ -| Column | Type | Key | Null | Default | Semantic Type | -+--------------+--------+------+------+---------+---------------+ -| region_id | UInt64 | | NO | | FIELD | -| peer_id | UInt64 | | YES | | FIELD | -| peer_addr | String | | YES | | FIELD | -| is_leader | String | | YES | | FIELD | -| status | String | | YES | | FIELD | -| down_seconds | Int64 | | YES | | FIELD | -+--------------+--------+------+------+---------+---------------+ ++---------------+--------+------+------+---------+---------------+ +| Column | Type | Key | Null | Default | Semantic Type | ++---------------+--------+------+------+---------+---------------+ +| table_catalog | String | | NO | | FIELD | +| table_schema | String | | NO | | FIELD | +| table_name | String | | NO | | FIELD | +| region_id | UInt64 | | NO | | FIELD | +| peer_id | UInt64 | | YES | | FIELD | +| peer_addr | String | | YES | | FIELD | +| is_leader | String | | YES | | FIELD | +| status | String | | YES | | FIELD | +| down_seconds | Int64 | | YES | | FIELD | ++---------------+--------+------+------+---------+---------------+ 6 rows in set (0.00 sec) ``` Fields in the `REGION_PEERS` table are described as follows: +- `table_catalog`: The catalog of the table. +- `table_schema`: The schema of the table. +- `table_name`: The name of the table. - `region_id`: The ID of the Region. - `peer_id`: The ID of the Region peer. - `peer_addr`: The address of the peer. diff --git a/docs/reference/sql/show.md b/docs/reference/sql/show.md index 6114f260b..cd4b2523f 100644 --- a/docs/reference/sql/show.md +++ b/docs/reference/sql/show.md @@ -380,6 +380,26 @@ SHOW COLUMNS FROM monitor WHERE Field = 'cpu'; +-------+--------+------+------+---------+-------+---------------+ ``` +To list all regions in a table: +```sql +SHOW REGION FROM monitor; +``` + +```sql ++----------------+---------------+------+--------+ +| Table | Region | Peer | Leader | ++----------------+---------------+------+--------+ +| monitor | 4398046511104 | 0 | Yes | ++----------------+---------------+------+--------+ +``` + +It is the extension of `INFORMATION_SCHEMA.REGION_PEERS` and supports `WHERE` too. + +The syntax is +```sql +SHOW REGION FROM [table] [IN database] [WHERE where] +``` + Other `SHOW` statements: * `SHOW STATUS` and `SHOW VARIABLES` are not supported, just return empty results. * `SHOW TABLE STATUS` is the extension of `INFORMATION_SCHEMA.TABLES`. \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/region-peers.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/region-peers.md index 88ebbed36..699d60f3b 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/region-peers.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/region-peers.md @@ -20,20 +20,26 @@ DESC REGION_PEERS; ```sql +--------------+--------+------+------+---------+---------------+ -| Column | Type | Key | Null | Default | Semantic Type | -+--------------+--------+------+------+---------+---------------+ -| region_id | UInt64 | | NO | | FIELD | -| peer_id | UInt64 | | YES | | FIELD | -| peer_addr | String | | YES | | FIELD | -| is_leader | String | | YES | | FIELD | -| status | String | | YES | | FIELD | -| down_seconds | Int64 | | YES | | FIELD | -+--------------+--------+------+------+---------+---------------+ +| Column | Type | Key | Null | Default | Semantic Type | ++---------------+--------+------+------+---------+---------------+ +| table_catalog | String | | NO | | FIELD | +| table_schema | String | | NO | | FIELD | +| table_name | String | | NO | | FIELD | +| region_id | UInt64 | | NO | | FIELD | +| peer_id | UInt64 | | YES | | FIELD | +| peer_addr | String | | YES | | FIELD | +| is_leader | String | | YES | | FIELD | +| status | String | | YES | | FIELD | +| down_seconds | Int64 | | YES | | FIELD | ++---------------+--------+------+------+---------+---------------+ 6 rows in set (0.00 sec) ``` `REGION_PEERS` 表中的字段描述如下: +- `table_catalog`:表所属的目录。 +- `table_schema`:表所属的数据库。 +- `table_name`:表的名称。 - `region_id`:Region 的 ID。 - `peer_id`:Region peer 的 ID。 - `peer_addr`:peer 的地址。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/show.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/show.md index a69146a70..11be1903b 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/show.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/show.md @@ -381,6 +381,27 @@ SHOW COLUMNS FROM monitor WHERE Field = 'cpu'; +-------+--------+------+------+---------+-------+---------------+ ``` +列出表中的所有 Region: + +```sql +SHOW REGION FROM monitor; +``` + +```sql ++----------------+---------------+------+--------+ +| Table | Region | Peer | Leader | ++----------------+---------------+------+--------+ +| monitor | 4398046511104 | 0 | Yes | ++----------------+---------------+------+--------+ +``` + +这是 `INFORMATION_SCHEMA.REGION_PEERS` 的扩展,并且支持 `WHERE` 子句。 + +语法是: +```sql +SHOW REGION FROM [table] [IN database] [WHERE where] +``` + 其他 `SHOW` 扩展语句: * `SHOW STATUS` 和 `SHOW VARIABLES` 不支持,仅返回空结果。 * `SHOW TABLE STATUS` 是 `INFORMATION_SCHEMA.TABLES` 的扩展。