The SHOW DEFAULT SHARDING STRATEGY syntax is used to query default sharding strategy in specified database.
ShowDefaultShardingStrategy::=
'SHOW' 'DEFAULT' 'SHARDING' 'STRATEGY' ('FROM' databaseName)?
databaseName ::=
identifier
databaseName is not specified, the default is the currently used DATABASE. If DATABASE is not used, No database selected will be prompted.| Column | Description |
|---|---|
| name | Sharding strategy scope |
| type | Sharding strategy type |
| sharding_column | Sharding column |
| sharding_algorithm_name | Sharding algorithm name |
| sharding_algorithm_type | Sharding algorithm type |
| sharding_algorithm_props | Sharding algorithm properties |
SHOW DEFAULT SHARDING STRATEGY FROM sharding_db;
mysql> SHOW DEFAULT SHARDING STRATEGY FROM sharding_db;
+----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
| name | type | sharding_column | sharding_algorithm_name | sharding_algorithm_type | sharding_algorithm_props |
+----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
| TABLE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
| DATABASE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
+----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
2 rows in set (0.00 sec)
SHOW DEFAULT SHARDING STRATEGY;
mysql> SHOW DEFAULT SHARDING STRATEGY;
+----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
| name | type | sharding_column | sharding_algorithm_name | sharding_algorithm_type | sharding_algorithm_props |
+----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
| TABLE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
| DATABASE | STANDARD | order_id | table_inline | inline | {algorithm-expression=t_order_item_${order_id % 2}} |
+----------+----------+-----------------+-------------------------+-------------------------+-----------------------------------------------------+
2 rows in set (0.00 sec)
SHOW, DEFAULT, SHARDING, STRATEGY, FROM
