Updated on 2022-09-16 GMT+08:00

SHOW RULE

Command Format:

show rule: used to view the sharding rule of each logical table in a certain schema.
show rule from table_name: displays the sharding rule of a specified logical table in a certain schema.

Command Output:

The following is an example output of show rule.

The following is an example output of show rule from table_name.

Output Details:

TABLE_NAME: indicates the name of the logical table.

BROADCAST: specifies whether the table is a broadcast table. 0 indicates that the table is not a broadcast table. 1 indicates the table is a broadcast table.

DB_PARTITION_KEY: indicates the database sharding key. Leave this field blank if database sharding is not required.

DB_PARTITION_POLICY: indicates the database sharding algorithm. The value can be HASH, YYYYMM, YYYYDD, and YYYYWEEK.

DB_PARTITION_COUNT: indicates the number of database shards.

DB_PARTITION_OFFSET: indicates where a new database shard starts from.

PARTITION_RANGE: indicates the sharding range when the database sharding algorithm is range.

TB_PARTITION_KEY: indicates the table sharding key. Leave this field blank if table sharding is not required.

TB_PARTITION_POLICY: indicates the table sharding algorithm. The value can be HASH, MM, DD, MMDD, or WEEK.

TB_PARTITION_COUNT: indicates the number of physical tables in each database shard.

TB_PARTITION_OFFSET: indicates where a new physical table starts from.