SHOW DEFAULT SHARDING STRATEGY

描述

SHOW DEFAULT SHARDING STRATEGY 语法用于查询指定逻辑库的默认分片策略。

语法

语法 铁路图

  1. ShowDefaultShardingStrategy::=
  2. 'SHOW' 'DEFAULT' 'SHARDING' 'STRATEGY' ('FROM' databaseName)?
  3. databaseName ::=
  4. identifier

补充说明

  • 未指定 databaseName 时,默认是当前使用的 DATABASE。 如果也未使用 DATABASE 则会提示 No database selected

返回值说明

说明
name分片策略范围
type分片策略类型
sharding_column分片键
sharding_algorithm_name分片算法名称
sharding_algorithm_type分片算法类型
sharding_algorithm_props分片算法参数

示例

  • 查询指定逻辑库的默认分片策略
  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)
  • 查询当前逻辑库的默认分片策略
  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)

保留字

SHOWDEFAULTSHARDINGSTRATEGYFROM

相关链接