Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 2.13 KB

sql-statement-show-placement.md

File metadata and controls

60 lines (44 loc) · 2.13 KB
title summary
SHOW PLACEMENT
The usage of SHOW PLACEMENT in TiDB.

SHOW PLACEMENT

Warning:

Placement Rules in SQL is an experimental feature. The syntax might change before its GA, and there might also be bugs.

If you understand the risks, you can enable this experiment feature by executing SET GLOBAL tidb_enable_alter_placement = 1;.

SHOW PLACEMENT summarizes all placement options from direct placement and placement policies, and presents them in canonical form.

Synopsis

ShowStmt ::=
    "PLACEMENT"

Examples

{{< 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;
CREATE TABLE t2 (a INT) PRIMARY_REGION="us-east-1" REGIONS="us-east-1,us-west-1" FOLLOWERS=4;
SHOW PLACEMENT;
Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 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       |
| TABLE test.t2 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1,us-west-1" FOLLOWERS=4 | INPROGRESS       |
+---------------+----------------------------------------------------------------------+------------------+
4 rows in set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also