COUNT SHARDING RULE
语法用于查询指定逻辑库中的分片规则数量。
CountShardingRule::=
'COUNT' 'SHARDING' 'RULE' ('FROM' databaseName)?
databaseName ::=
identifier
databaseName
时,默认是当前使用的 DATABASE
。 如果也未使用 DATABASE
则会提示 No database selected
。列 | 说明 |
---|---|
rule_name | 规则类型 |
database | 规则所属逻辑库 |
count | 规则数量 |
COUNT SHARDING RULE FROM test1;
mysql> COUNT SHARDING RULE FROM test1;
+--------------------------+----------+-------+
| rule_name | database | count |
+--------------------------+----------+-------+
| sharding_table | test1 | 2 |
| sharding_table_reference | test1 | 2 |
| broadcast_table | test1 | 0 |
+--------------------------+----------+-------+
3 rows in set (0.00 sec)
COUNT SHARDING RULE;
mysql> COUNT SHARDING RULE;
+--------------------------+----------+-------+
| rule_name | database | count |
+--------------------------+----------+-------+
| sharding_table | test1 | 2 |
| sharding_table_reference | test1 | 2 |
| broadcast_table | test1 | 0 |
+--------------------------+----------+-------+
3 rows in set (0.00 sec)
COUNT
、SHARDING
、RULE
、FROM