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

SHOW SHARDING TABLE NODES

描述

SHOW SHARDING TABLE NODES 语法用于查询指定逻辑库中的指定分片表的节点分布。

语法

ShowShardingTableNode::=
  'SHOW' 'SHARDING' 'TABLE' 'NODES' tableName? ('FROM' databaseName)?

tableName ::=
  identifier

databaseName ::=
  identifier

补充说明

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

返回值说明

说明
name 分片规则名称
nodes 分片节点

示例

  • 查询指定逻辑库中指定分片表的节点分布
SHOW SHARDING TABLE NODES t_order_item FROM sharding_db;
mysql> SHOW SHARDING TABLE NODES t_order_item FROM sharding_db;
+--------------+------------------------------------------------------------------------------------------------------------+
| name         | nodes                                                                                                      |
+--------------+------------------------------------------------------------------------------------------------------------+
| t_order_item | resource_0.t_order_item_0, resource_0.t_order_item_1, resource_1.t_order_item_0, resource_1.t_order_item_1 |
+--------------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
  • 查询当前逻辑库中指定分片表的节点分布
SHOW SHARDING TABLE NODES t_order_item;
mysql> SHOW SHARDING TABLE NODES t_order_item;
+--------------+------------------------------------------------------------------------------------------------------------+
| name         | nodes                                                                                                      |
+--------------+------------------------------------------------------------------------------------------------------------+
| t_order_item | resource_0.t_order_item_0, resource_0.t_order_item_1, resource_1.t_order_item_0, resource_1.t_order_item_1 |
+--------------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
  • 查询指定逻辑库中所有分片表的节点分布
SHOW SHARDING TABLE NODES FROM sharding_db;
mysql> SHOW SHARDING TABLE NODES FROM sharding_db;
+--------------+------------------------------------------------------------------------------------------------------------+
| name         | nodes                                                                                                      |
+--------------+------------------------------------------------------------------------------------------------------------+
| t_order_item | resource_0.t_order_item_0, resource_0.t_order_item_1, resource_1.t_order_item_0, resource_1.t_order_item_1 |
+--------------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
  • 查询当前逻辑库中所有分片表的节点分布
SHOW SHARDING TABLE NODES;
mysql> SHOW SHARDING TABLE NODES;
+--------------+------------------------------------------------------------------------------------------------------------+
| name         | nodes                                                                                                      |
+--------------+------------------------------------------------------------------------------------------------------------+
| t_order_item | resource_0.t_order_item_0, resource_0.t_order_item_1, resource_1.t_order_item_0, resource_1.t_order_item_1 |
+--------------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

保留字

SHOWSHARDINGTABLENODESFROM

相关链接