tencent cloud

TDSQL Boundless

Release Notes
Product Introduction
Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
Kernel Features
Kernel Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Billing
Billing Overview
Purchase Method
Pricing Details
Renewal
Overdue Payments
Refund
Getting Started
Creating an Instance
Connect to Instances
User Guide
Data Migration
Data Subscription
Instance Management
Configuration Change
Parameter Configuration
Account Management
Security Group
Backup and Restoration
Database Auditing
Tag Management
Use Cases
Technical Evolution and Usage Practices of Online DDL
Lock Mechanism Analysis and Troubleshooting Practices
Data Intelligent Scheduling and Related Practices for Performance Optimization
TDSQL Boundless Selection Guide and Practical Tutorial
Developer Guide
Developer Guide (MySQL Compatibility Mode)
Developer Guide (HBase Compatibility Mode)
Performance Tuning
Performance Tuning Overview
SQL Tuning
DDL Tuning
Performance White Paper
Performance Overview
TPC-C Test
Sysbench Test
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Security Group APIs
Task APIs
Backup APIs
Rollback APIs
Parameter APIs
Database APIs
Data Types
Error Codes
General Reference
System Architecture
SQL Reference
Database Parameter Description
TPC-H benchmark data model reference
Error Code Information
Security and Compliance
FAQs
Agreements
Service Level Agreement
Terms of Service
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

ALTER TABLE

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-02-10 11:25:12

Description

Modify the structure of an existing table, such as altering the bound policy for partition affinity.

Syntax

alter_table_stmt:
ALTER TABLE table_name USING PARTITION POLICY partition_policy_name
| ALTER TABLE table_name DROP PARTITION POLICY_ [FORCE]

Parameter Description

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.

Examples

Operations for modifying and unbinding affinity policies.
# Create policy for partition affinity pp1
tdsql [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 partitions
tdsql [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 pp1
tdsql [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)

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백