SHOW DEFAULT SHARDING STRATEGY

Description

The SHOW DEFAULT SHARDING STRATEGY syntax is used to query default sharding strategy in specified database.

Syntax

Grammar Railroad diagram

  1. ShowDefaultShardingStrategy::=
  2. 'SHOW' 'DEFAULT' 'SHARDING' 'STRATEGY' ('FROM' databaseName)?
  3. databaseName ::=
  4. 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
nameSharding strategy scope
typeSharding strategy type
sharding_columnSharding column
sharding_algorithm_nameSharding algorithm name
sharding_algorithm_typeSharding algorithm type
sharding_algorithm_propsSharding algorithm properties

Example

  • Query default sharding strategy in specified database.
  1. SHOW DEFAULT SHARDING STRATEGY FROM sharding_db;
  1. mysql> SHOW DEFAULT SHARDING STRATEGY FROM sharding_db;
  2. +----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
  3. | name | type | sharding_column | sharding_algorithm_name | sharding_algorithm_type | sharding_algorithm_props |
  4. +----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
  5. | TABLE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
  6. | DATABASE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
  7. +----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
  8. 2 rows in set (0.00 sec)
  • Query default sharding strategy in current database.
  1. SHOW DEFAULT SHARDING STRATEGY;
  1. mysql> SHOW DEFAULT SHARDING STRATEGY;
  2. +----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
  3. | name | type | sharding_column | sharding_algorithm_name | sharding_algorithm_type | sharding_algorithm_props |
  4. +----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
  5. | TABLE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
  6. | DATABASE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
  7. +----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
  8. 2 rows in set (0.00 sec)

Reserved word

SHOW, DEFAULT, SHARDING, STRATEGY, FROM