SHOW SHARDING TABLE RULE

Description

The SHOW SHARDING TABLE RULE syntax is used to query the sharding table rule in the specified database.

Syntax

  1. ShowShardingTableRule ::=
  2. 'SHOW' 'SHARDING' 'TABLE' ('RULE' tableName | 'RULES') ('FROM' databaseName)?
  3. tableName ::=
  4. identifier
  5. databaseName ::=
  6. identifier

Supplement

  • When databaseName is not specified, the default is the currently used DATABASE. If DATABASE is not used, No database selected will be prompted.

Return value description

ColumnDescription
tableLogical table name
actual_data_nodesActual data node
actual_data_sourcesActual data source (Displayed when creating rules by RDL)
database_strategy_typeDatabase sharding strategy type
database_sharding_columnDatabase sharding column
database_sharding_algorithm_typeDatabase sharding algorithm type
database_sharding_algorithm_propsDatabase sharding algorithm properties
table_strategy_typeTable sharding strategy type
table_sharding_columnTable sharding column
table_sharding_algorithm_typeTable sharding algorithm type
table_sharding_algorithm_propsTable sharding algorithm properties
key_generate_columnSharding key generator column
key_generator_typeSharding key generator type
key_generator_propsSharding key generator properties

Example

  • Query the sharding table rules of the specified logical database
  1. SHOW SHARDING TABLE RULES FROM sharding_db;
  1. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  2. | 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 |
  3. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  4. | t_order | | ds_0,ds_1 | | | | | mod | order_id | mod | sharding-count=4 | | | |
  5. | t_order_item | | ds_0,ds_1 | | | | | mod | order_id | mod | sharding-count=4 | | | |
  6. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  7. 2 rows in set (0.12 sec)
  • Query the sharding table rules of the current logic database
  1. SHOW SHARDING TABLE RULES;
  1. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  2. | 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 |
  3. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  4. | t_order | | ds_0,ds_1 | | | | | mod | order_id | mod | sharding-count=4 | | | |
  5. | t_order_item | | ds_0,ds_1 | | | | | mod | order_id | mod | sharding-count=4 | | | |
  6. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  7. 2 rows in set (0.12 sec)
  • Query the specified sharding table rule
  1. SHOW SHARDING TABLE RULE t_order;
  1. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  2. | 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 |
  3. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  4. | t_order | | ds_0,ds_1 | | | | | mod | order_id | mod | sharding-count=4 | | | |
  5. +--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
  6. 1 rows in set (0.12 sec)

Reserved word

SHOW, SHARDING, TABLE, RULE, FROM