Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 1.22 KB

sql-statement-alter-range.md

File metadata and controls

36 lines (25 loc) · 1.22 KB
title summary
ALTER RANGE
An overview of the usage of ALTER RANGE for TiDB.

ALTER RANGE

Currently, the ALTER RANGE statement can only be used to modify the range of a specific placement policy in TiDB.

Note:

This feature is not available on TiDB Cloud Serverless clusters.

Synopsis

AlterRangeStmt ::=
    'ALTER' 'RANGE' Identifier PlacementPolicyOption

ALTER RANGE supports the following two parameters:

  • global: indicates the range of all data in a cluster.
  • meta: indicates the range of internal metadata stored in TiDB.

Examples

CREATE PLACEMENT POLICY `deploy111` CONSTRAINTS='{"+region=us-east-1":1, "+region=us-east-2": 1, "+region=us-west-1": 1}';
CREATE PLACEMENT POLICY `five_replicas` FOLLOWERS=4;

ALTER RANGE global PLACEMENT POLICY = "deploy111";
ALTER RANGE meta PLACEMENT POLICY = "five_replicas";

The preceding example creates two placement policies (deploy111 and five_replicas), specifies constraints for different regions, and then applies the deploy111 placement policy to all data in the cluster range and the five_replicas placement policy to the metadata range.