配置ポリシー

PLACEMENT_POLICIES表には、すべての配置ポリシーに関する情報が記載されています。詳細については、 SQL の配置ルールを参照してください。

注記:

このテーブルはTiDB サーバーレスクラスターでは使用できません。

USE information_schema; DESC placement_policies;
+----------------------+---------------+------+-----+---------+-------+ | 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)

PLACEMENT_POLICIESテーブルには、すべての配置ポリシーのみが表示されます。配置ルールの標準バージョン (すべての配置ポリシーと配置ポリシーが割り当てられたオブジェクトを含む) を表示するには、代わりにステートメントSHOW PLACEMENTを使用します。

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.
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)

このページは役に立ちましたか?