SHOW DEFAULT SHARDING STRATEGY
描述
SHOW DEFAULT SHARDING STRATEGY
语法用于查询指定逻辑库的默认分片策略。
语法
语法 铁路图
ShowDefaultShardingStrategy::=
'SHOW' 'DEFAULT' 'SHARDING' 'STRATEGY' ('FROM' databaseName)?
databaseName ::=
identifier
补充说明
- 未指定
databaseName
时,默认是当前使用的DATABASE
。 如果也未使用DATABASE
则会提示No database selected
。
返回值说明
列 | 说明 |
---|---|
name | 分片策略范围 |
type | 分片策略类型 |
sharding_column | 分片键 |
sharding_algorithm_name | 分片算法名称 |
sharding_algorithm_type | 分片算法类型 |
sharding_algorithm_props | 分片算法参数 |
示例
- 查询指定逻辑库的默认分片策略
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
相关链接
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .