-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*: refine placement documents (#7885)
* *: refine placement documents Signed-off-by: xhe <[email protected]> * *: reword Signed-off-by: xhe <[email protected]> * *: improve words, update compatibility Signed-off-by: xhe <[email protected]> * address comments Signed-off-by: xhe <[email protected]> * fix lint Signed-off-by: xhe <[email protected]> * sync with cn doc Signed-off-by: xhe <[email protected]> * sync with cn Signed-off-by: xhe <[email protected]> * Update information-schema/information-schema-placement-policies.md Co-authored-by: Ran <[email protected]> * variable update Signed-off-by: xhe <[email protected]> * compatibility refine Signed-off-by: xhe <[email protected]> * fix CI Signed-off-by: xhe <[email protected]> * sync with cn Signed-off-by: xhe <[email protected]> * remove enable_alter Signed-off-by: xhe <[email protected]> * Update system-variables.md Co-authored-by: TomShawn <[email protected]> * Apply suggestions from code review Co-authored-by: TomShawn <[email protected]> * Update system-variables.md Co-authored-by: TomShawn <[email protected]> * Update sql-statements/sql-statement-alter-placement-policy.md Co-authored-by: TomShawn <[email protected]> * Update system-variables.md Co-authored-by: TomShawn <[email protected]> * reword Signed-off-by: xhe <[email protected]> Co-authored-by: Ran <[email protected]> Co-authored-by: TomShawn <[email protected]>
- Loading branch information
1 parent
20150b6
commit 91fe4b0
Showing
11 changed files
with
186 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
information-schema/information-schema-placement-policies.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
title: PLACEMENT_POLICIES | ||
summary: Learn the `PLACEMENT_POLICIES` information_schema table. | ||
aliases: ['/tidb/dev/information-schema-placement-rules'] | ||
--- | ||
|
||
# PLACEMENT_POLICIES | ||
|
||
The `PLACEMENT_POLICIES` table provides information on all placement policies. For details, refer to [Placement Rules in SQL](/placement-rules-in-sql.md). | ||
|
||
{{< copyable "sql" >}} | ||
|
||
```sql | ||
USE information_schema; | ||
DESC placement_policies; | ||
``` | ||
|
||
```sql | ||
+----------------------+---------------+------+-----+---------+-------+ | ||
| Field | Type | Null | Key | Default | Extra | | ||
+----------------------+---------------+------+-----+---------+-------+ | ||
| POLICY_ID | bigint(64) | NO | | <null> | | | ||
| CATALOG_NAME | varchar(512) | NO | | <null> | | | ||
| POLICY_NAME | varchar(64) | NO | | <null> | | | ||
| PRIMARY_REGION | varchar(1024) | YES | | <null> | | | ||
| REGIONS | varchar(1024) | YES | | <null> | | | ||
| CONSTRAINTS | varchar(1024) | YES | | <null> | | | ||
| LEADER_CONSTRAINTS | varchar(1024) | YES | | <null> | | | ||
| FOLLOWER_CONSTRAINTS | varchar(1024) | YES | | <null> | | | ||
| LEARNER_CONSTRAINTS | varchar(1024) | YES | | <null> | | | ||
| SCHEDULE | varchar(20) | YES | | <null> | | | ||
| FOLLOWERS | bigint(64) | YES | | <null> | | | ||
| LEARNERS | bigint(64) | YES | | <null> | | | ||
+----------------------+---------------+------+-----+---------+-------+ | ||
12 rows in set (0.00 sec) | ||
``` | ||
|
||
## Examples | ||
|
||
The `PLACEMENT_POLICIES` table only shows all placement policies. To view the canonical version of placement rules (including all placement policies and objects assigned placement policies), use the statement `SHOW PLACEMENT` instead: | ||
|
||
{{< copyable "sql" >}} | ||
|
||
```sql | ||
CREATE TABLE t1 (a INT); | ||
CREATE PLACEMENT POLICY p1 primary_region="us-east-1" regions="us-east-1"; | ||
CREATE TABLE t3 (a INT) PLACEMENT POLICY=p1; | ||
SHOW PLACEMENT; -- Shows all information, including table t3. | ||
SELECT * FROM information_schema.placement_policies; -- Only shows placement policies, excluding t3. | ||
``` | ||
|
||
```sql | ||
Query OK, 0 rows affected (0.09 sec) | ||
|
||
Query OK, 0 rows affected (0.11 sec) | ||
|
||
Query OK, 0 rows affected (0.08 sec) | ||
|
||
+---------------+------------------------------------------------+------------------+ | ||
| Target | Placement | Scheduling_State | | ||
+---------------+------------------------------------------------+------------------+ | ||
| POLICY p1 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1" | NULL | | ||
| TABLE test.t3 | PRIMARY_REGION="us-east-1" REGIONS="us-east-1" | PENDING | | ||
+---------------+------------------------------------------------+------------------+ | ||
2 rows in set (0.00 sec) | ||
|
||
+-----------+--------------+-------------+----------------+-----------+-------------+--------------------+----------------------+---------------------+----------+-----------+----------+ | ||
| POLICY_ID | CATALOG_NAME | POLICY_NAME | PRIMARY_REGION | REGIONS | CONSTRAINTS | LEADER_CONSTRAINTS | FOLLOWER_CONSTRAINTS | LEARNER_CONSTRAINTS | SCHEDULE | FOLLOWERS | LEARNERS | | ||
+-----------+--------------+-------------+----------------+-----------+-------------+--------------------+----------------------+---------------------+----------+-----------+----------+ | ||
| 1 | def | p1 | us-east-1 | us-east-1 | | | | | | 2 | 0 | | ||
+-----------+--------------+-------------+----------------+-----------+-------------+--------------------+----------------------+---------------------+----------+-----------+----------+ | ||
1 rows in set (0.00 sec) | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.