You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/04/15 07:05:03 UTC

[shardingsphere] branch master updated: `SHOW SHARDING TABLE RULE` syntax doc (#16824)

This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new eae00f5dd54 `SHOW SHARDING TABLE RULE` syntax doc (#16824)
eae00f5dd54 is described below

commit eae00f5dd54f098da3ea7b64672647abc7d0e725
Author: lanchengx <52...@users.noreply.github.com>
AuthorDate: Fri Apr 15 15:04:56 2022 +0800

    `SHOW SHARDING TABLE RULE` syntax doc (#16824)
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * Update show-sharding-table-rule.cn.md
    
    * Update show-sharding-table-rule.en.md
---
 .../syntax/rql/resource-query/show-resource.cn.md  |  2 +-
 .../syntax/rql/resource-query/show-resource.en.md  |  2 +-
 .../rql/rule-query/show-sharding-table-rule.cn.md  | 84 ++++++++++++++++++++++
 .../rql/rule-query/show-sharding-table-rule.en.md  | 84 ++++++++++++++++++++++
 4 files changed, 170 insertions(+), 2 deletions(-)

diff --git a/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.cn.md b/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.cn.md
index def4a0412d0..3f27ab780a7 100644
--- a/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.cn.md
+++ b/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.cn.md
@@ -36,7 +36,7 @@ schemaName ::=
  ### 示例
 - 查询指定逻辑库的资源
 ```sql
-SHOW SCHEMA RESOURCES FROM example_db;
+SHOW SCHEMA RESOURCES FROM sharding_db;
 ```
 ```sql
 +------+-------+-----------+------+------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [...]
diff --git a/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.en.md b/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.en.md
index 3a77a17f8c0..65b54500dc6 100644
--- a/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.en.md
+++ b/docs/document/content/reference/distsql/syntax/rql/resource-query/show-resource.en.md
@@ -37,7 +37,7 @@ schemaName ::=
 - Query resources for the specified schema
 
 ```sql
-SHOW SCHEMA RESOURCES FROM example_db;
+SHOW SCHEMA RESOURCES FROM sharding_db;
 ```
 ```sql
 +------+-------+-----------+------+------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [...]
diff --git a/docs/document/content/reference/distsql/syntax/rql/rule-query/show-sharding-table-rule.cn.md b/docs/document/content/reference/distsql/syntax/rql/rule-query/show-sharding-table-rule.cn.md
new file mode 100644
index 00000000000..a84be61e5a7
--- /dev/null
+++ b/docs/document/content/reference/distsql/syntax/rql/rule-query/show-sharding-table-rule.cn.md
@@ -0,0 +1,84 @@
++++
+title = "SHOW SHARDING TABLE RULE"
+weight = 3
++++
+
+
+### 描述
+
+`SHOW SHARDING TABLE RULE` 语法用于查询指定逻辑库中的分片规则。
+
+### 语法
+```
+ShowShardingTableRule ::=
+  'SHOW' 'SHARDING' 'TABLE' ('RULE' tableName | 'RULES') ('FROM' schemaName)?
+
+tableName ::=
+  identifier
+
+schemaName ::=
+  identifier
+```
+
+### 补充说明
+- 未指定 `schemaName` 时,默认是当前使用的 `SCHEMA`。 如果也未使用 `SCHEMA` 则会提示 `No database selected`。
+
+ ### 返回值说明
+
+| 列                                | 说明                                |
+| --------------------------------- | ---------------------------------- |
+| table                             | 逻辑表名                            |
+| actual_data_nodes                 | 实际的数据节点                       |
+| actual_data_sources               | 实际的数据源(通过 RDL 创建的规则时显示)|
+| database_strategy_type            | 数据库分片策略类型                    |
+| database_sharding_column          | 数据库分片键                         |
+| database_sharding_algorithm_type  | 数据库分片算法类型                    |
+| database_sharding_algorithm_props | 数据库分片算法参数                    |
+| table_strategy_type               | 表分片策略类型                       |
+| table_sharding_column             | 表分片键                            |
+| table_sharding_algorithm_type     | 表分片算法类型                       |
+| table_sharding_algorithm_props    | 表分片算法参数                       |
+| key_generate_column               | 分布式主键生成列                     |
+| key_generator_type                | 分布式主键生成器类型                  |
+| key_generator_props               | 分布式主键生成器参数                  |
+
+ ### 示例
+- 查询指定逻辑库的分片规则
+```sql
+SHOW SHARDING TABLE RULES FROM sharding_db;
+```
+```sql
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| table        | actual_data_nodes | actual_data_sources | database_strategy_type | database_sharding_column | database_sharding_algorithm_type | database_sharding_algorithm_props | table_strategy_type | table_sharding_column | table_sharding_algorithm_type | table_sharding_algorithm_props | key_generate_column | key_generator_type | key_generator_props |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| t_order      |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
+| t_order_item |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+2 rows in set (0.12 sec)
+```
+
+- 查询当前逻辑库的分片规则
+```sql
+SHOW SHARDING TABLE RULES;
+```
+```sql
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| table        | actual_data_nodes | actual_data_sources | database_strategy_type | database_sharding_column | database_sharding_algorithm_type | database_sharding_algorithm_props | table_strategy_type | table_sharding_column | table_sharding_algorithm_type | table_sharding_algorithm_props | key_generate_column | key_generator_type | key_generator_props |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| t_order      |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
+| t_order_item |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+2 rows in set (0.12 sec)
+```
+- 查询指定逻辑表的分片规则
+```sql
+SHOW SHARDING TABLE RULE t_order;
+```
+```sql
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| table        | actual_data_nodes | actual_data_sources | database_strategy_type | database_sharding_column | database_sharding_algorithm_type | database_sharding_algorithm_props | table_strategy_type | table_sharding_column | table_sharding_algorithm_type | table_sharding_algorithm_props | key_generate_column | key_generator_type | key_generator_props |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| t_order      |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+1 rows in set (0.12 sec)
+```
diff --git a/docs/document/content/reference/distsql/syntax/rql/rule-query/show-sharding-table-rule.en.md b/docs/document/content/reference/distsql/syntax/rql/rule-query/show-sharding-table-rule.en.md
new file mode 100644
index 00000000000..34480117500
--- /dev/null
+++ b/docs/document/content/reference/distsql/syntax/rql/rule-query/show-sharding-table-rule.en.md
@@ -0,0 +1,84 @@
++++
+title = "SHOW SHARDING TABLE RULE"
+weight = 3
++++
+
+
+### Description
+
+The `SHOW SHARDING TABLE RULE` syntax is used to query the sharding table rule in the specified schema.
+
+### Syntax
+```
+ShowShardingTableRule ::=
+  'SHOW' 'SHARDING' 'TABLE' ('RULE' tableName | 'RULES') ('FROM' schemaName)?
+
+tableName ::=
+  identifier
+
+schemaName ::=
+  identifier
+```
+
+### Supplement
+- When `schemaName` is not specified, the default is the currently used `SCHEMA`. If `SCHEMA` is not used, `No database selected` will be prompted.
+
+ ### Return value description
+
+| Column                            | Description                                               |
+| --------------------------------- | --------------------------------------------------------- |
+| table                             | Logical table name                                        |
+| actual_data_nodes                 | Actual data node                                          |
+| actual_data_sources               | Actual data source (Displayed when creating rules by RDL) |
+| database_strategy_type            | Database sharding strategy type                           |
+| database_sharding_column          | Database sharding column                                  |
+| database_sharding_algorithm_type  | Database sharding algorithm type                          |
+| database_sharding_algorithm_props | Database sharding algorithm properties                    |
+| table_strategy_type               | Table sharding strategy type                              |
+| table_sharding_column             | Table sharding column                                     |
+| table_sharding_algorithm_type     | Table sharding algorithm type                             |
+| table_sharding_algorithm_props    | Table sharding algorithm properties                       |
+| key_generate_column               | Sharding key generator column                             |
+| key_generator_type                | Sharding key generator type                               |
+| key_generator_props               | Sharding key generator properties                         |
+
+ ### Example
+- Query the sharding table rules of the specified logical schema
+```sql
+SHOW SHARDING TABLE RULES FROM sharding_db;
+```
+```sql
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| table        | actual_data_nodes | actual_data_sources | database_strategy_type | database_sharding_column | database_sharding_algorithm_type | database_sharding_algorithm_props | table_strategy_type | table_sharding_column | table_sharding_algorithm_type | table_sharding_algorithm_props | key_generate_column | key_generator_type | key_generator_props |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| t_order      |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
+| t_order_item |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+2 rows in set (0.12 sec)
+```
+
+- Query the sharding table rules of the current logic schema
+```sql
+SHOW SHARDING TABLE RULES;
+```
+```sql
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| table        | actual_data_nodes | actual_data_sources | database_strategy_type | database_sharding_column | database_sharding_algorithm_type | database_sharding_algorithm_props | table_strategy_type | table_sharding_column | table_sharding_algorithm_type | table_sharding_algorithm_props | key_generate_column | key_generator_type | key_generator_props |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| t_order      |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
+| t_order_item |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+2 rows in set (0.12 sec)
+```
+- Query the specified sharding table rule
+```sql
+SHOW SHARDING TABLE RULE t_order;
+```
+```sql
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| table        | actual_data_nodes | actual_data_sources | database_strategy_type | database_sharding_column | database_sharding_algorithm_type | database_sharding_algorithm_props | table_strategy_type | table_sharding_column | table_sharding_algorithm_type | table_sharding_algorithm_props | key_generate_column | key_generator_type | key_generator_props |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+| t_order      |                   | ds_0,ds_1           |                        |                          |                                  |                                   | mod                 | order_id              | mod                           | sharding-count=4               |                     |                    |                     |
++--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
+1 rows in set (0.12 sec)
+```