Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.4 KB

sql-statement-show-create-placement-policy.md

File metadata and controls

51 lines (36 loc) · 1.4 KB
title summary
SHOW CREATE PLACEMENT POLICY
TiDB 数据库中 SHOW CREATE PLACEMENT POLICY 的使用概况。

SHOW CREATE PLACEMENT POLICY

SHOW CREATE PLACEMENT POLICY 语句可用于查看放置策略当前的定义,并在另一个 TiDB 集群中重新创建该策略。

语法图

ShowCreatePlacementPolicyStmt ::=
    "SHOW" "CREATE" "PLACEMENT" "POLICY" PolicyName

PolicyName ::=
    Identifier

示例

{{< copyable "sql" >}}

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 CREATE PLACEMENT POLICY p1\G
Query OK, 0 rows affected (0.08 sec)

Query OK, 0 rows affected (0.10 sec)

***************************[ 1. row ]***************************
Policy        | p1
Create Policy | CREATE PLACEMENT POLICY `p1` PRIMARY_REGION="us-east-1" REGIONS="us-east-1,us-west-1" FOLLOWERS=4
1 row in set (0.00 sec)

MySQL 兼容性

该语句是 TiDB 对 MySQL 语法的扩展。

另请参阅