Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
alter_table_stmt:ALTER TABLE table_name USING PARTITION POLICY partition_policy_name| ALTER TABLE table_name DROP PARTITION POLICY_ [FORCE]
Parameter | Required | Description |
ALTER TABLE table_name USING PARTITION POLICY partition_policy_name | Optional | Modify the policy for partition affinity bound to the table, where table_name and partition_policy_name need to be explicitly specified. |
ALTER TABLE table_name DROP PARTITION POLICY_ [FORCE] | Optional | Unbind the policy for partition affinity bound to the table. table_name needs to be explicitly specified.FORCE option:If the parameter is specified, after a successful execution, the current table will no longer be bound to any affinity policy. If not specified, the system will attempt to unbind the currently bound explicit policy for affinity from the table and then bind it to the potential implicit policy for affinity. |
# Create policy for partition affinity pp1tdsql [demo]> create partition policy pp1 partition by hash(int) partitions 4;Query OK, 0 rows affected (0.02 sec)# Create table t with 4 hash partitionstdsql [demo]> create table t(id INT) partition by hash(id) partitions 4;Query OK, 0 rows affected (0.90 sec)# Bind table t to the policy for partition affinity pp1tdsql [demo]> alter table t using partition policy pp1;Query OK, 0 rows affected (0.64 sec)# Unbind the partition affinity of table t. After the unbinding is complete, table t will be automatically bound to the corresponding policy for implicit affinity.tdsql [demo]> alter table t drop partition policy;Query OK, 0 rows affected (0.66 sec)# Completely unbind the policy for partition affinity of table t. Once completed, table t will not be bound to any policy for partition affinity.MySQL [demo]> alter table t drop partition policy force;Query OK, 0 rows affected (0.61 sec)
피드백