SHOW SHARDING TABLE NODES

描述

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

语法

语法 铁路图

  1. ShowShardingTableNode::=
  2. 'SHOW' 'SHARDING' 'TABLE' 'NODES' tableName? ('FROM' databaseName)?
  3. tableName ::=
  4. identifier
  5. databaseName ::=
  6. identifier

补充说明

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

返回值说明

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

示例

  • 查询指定逻辑库中指定分片表的节点分布
  1. SHOW SHARDING TABLE NODES t_order_item FROM sharding_db;
  1. mysql> SHOW SHARDING TABLE NODES t_order_item FROM sharding_db;
  2. +--------------+------------------------------------------------------------------------------------------------------------+
  3. | name | nodes |
  4. +--------------+------------------------------------------------------------------------------------------------------------+
  5. | 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 |
  6. +--------------+------------------------------------------------------------------------------------------------------------+
  7. 1 row in set (0.00 sec)
  • 查询当前逻辑库中指定分片表的节点分布
  1. SHOW SHARDING TABLE NODES t_order_item;
  1. mysql> SHOW SHARDING TABLE NODES t_order_item;
  2. +--------------+------------------------------------------------------------------------------------------------------------+
  3. | name | nodes |
  4. +--------------+------------------------------------------------------------------------------------------------------------+
  5. | 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 |
  6. +--------------+------------------------------------------------------------------------------------------------------------+
  7. 1 row in set (0.00 sec)
  • 查询指定逻辑库中所有分片表的节点分布
  1. SHOW SHARDING TABLE NODES FROM sharding_db;
  1. mysql> SHOW SHARDING TABLE NODES FROM sharding_db;
  2. +--------------+------------------------------------------------------------------------------------------------------------+
  3. | name | nodes |
  4. +--------------+------------------------------------------------------------------------------------------------------------+
  5. | 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 |
  6. +--------------+------------------------------------------------------------------------------------------------------------+
  7. 1 row in set (0.00 sec)
  • 查询当前逻辑库中所有分片表的节点分布
  1. SHOW SHARDING TABLE NODES;
  1. mysql> SHOW SHARDING TABLE NODES;
  2. +--------------+------------------------------------------------------------------------------------------------------------+
  3. | name | nodes |
  4. +--------------+------------------------------------------------------------------------------------------------------------+
  5. | 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 |
  6. +--------------+------------------------------------------------------------------------------------------------------------+
  7. 1 row in set (0.00 sec)

保留字

SHOWSHARDINGTABLENODESFROM

相关链接