SHOW PLACEMENT
SHOW PLACEMENT
汇总了所有放置策略 (placement policy),并用统一的形式呈现相关信息。
本语句返回结果中的 Scheduling_State
列标识了 Placement Driver (PD) 在当前对象上的调度进度,有以下可能结果:
PENDING
: PD 没有进行调度。可能的原因之一是放置规则虽然语法上正确,但集群拓扑并不满足。比如指定FOLLOWERS=4
但只有 3 个可用作 follower 的 TiKV 实例。INPROGRESS
: PD 正在进行调度。SCHEDULED
: PD 调度完成。
语法图
ShowStmt
ShowStmt ::=
"SHOW" "PLACEMENT" ShowLikeOrWhere?
示例
CREATE PLACEMENT POLICY p1 PRIMARY_REGION="us-east-1" REGIONS="us-east-1,us-west-1" FOLLOWERS=4;
CREATE TABLE t1 (a INT) PLACEMENT POLICY=p1;
SHOW PLACEMENT;
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
+---------------+----------------------------------------------------------------------+------------------+
| Target | Placement | Scheduling_State |
+---------------+----------------------------------------------------------------------+------------------+
| POLICY p1 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1,us-west-1" FOLLOWERS=4 | NULL |
| DATABASE test | PRIMARY_REGION="us-east-1" REGIONS="us-east-1,us-west-1" FOLLOWERS=4 | INPROGRESS |
| TABLE test.t1 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1,us-west-1" FOLLOWERS=4 | INPROGRESS |
+---------------+----------------------------------------------------------------------+------------------+
4 rows in set (0.00 sec)
MySQL 兼容性
该语句是 TiDB 对 MySQL 语法的扩展。