复古 护眼 海天 深邃 暗黑 默认

SHOW SHARDING TABLE REFERENCE RULE

描述

SHOW SHARDING BINDING TABLE RULE 语法用于查询指定逻辑库中指定分片表关联规则。

语法

ShowShardingBindingTableRules::=
  'SHOW' 'SHARDING' 'TABLE' 'REFERENCE' ('RULE' ruleName | 'RULES') ('FROM' databaseName)?

ruleName ::=
    identifier

databaseName ::=
  identifier

补充说明

  • 未指定 databaseName 时,默认是当前使用的 DATABASE。 如果也未使用 DATABASE 则会提示 No database selected

返回值说明

说明
name 分片表关联规则名称
sharding_table_reference 分片表关联关系

示例

  • 查询指定逻辑库中的分片表关联规则
SHOW SHARDING TABLE REFERENCE RULES FROM sharding_db;
mysql> SHOW SHARDING TABLE REFERENCE RULES FROM sharding_db;
+-------+--------------------------+
| name  | sharding_table_reference |
+-------+--------------------------+
| ref_0 | t_a,t_b                  |
| ref_1 | t_c,t_d                  |
+-------+--------------------------+
2 rows in set (0.00 sec)
  • 查询当前逻辑库中的分片表关联规则
SHOW SHARDING TABLE REFERENCE RULES;
mysql> SHOW SHARDING TABLE REFERENCE RULES;
+-------+--------------------------+
| name  | sharding_table_reference |
+-------+--------------------------+
| ref_0 | t_a,t_b                  |
| ref_1 | t_c,t_d                  |
+-------+--------------------------+
2 rows in set (0.00 sec)
  • 查询指定逻辑库中的指定分片表关联规则
SHOW SHARDING TABLE REFERENCE RULE ref_0 FROM sharding_db;
mysql> SHOW SHARDING TABLE REFERENCE RULE ref_0 FROM sharding_db;
+-------+--------------------------+
| name  | sharding_table_reference |
+-------+--------------------------+
| ref_0 | t_a,t_b                  |
+-------+--------------------------+
1 row in set (0.00 sec)
  • 查询当前逻辑库中的分片表关联规则
SHOW SHARDING TABLE REFERENCE RULE ref_0;
mysql> SHOW SHARDING TABLE REFERENCE RULE ref_0;
+-------+--------------------------+
| name  | sharding_table_reference |
+-------+--------------------------+
| ref_0 | t_a,t_b                  |
+-------+--------------------------+
1 row in set (0.00 sec)

保留字

SHOWSHARDINGTABLEREFERENCERULERULESFROM

相关链接