Help Center/
GaussDB/
Feature Guide(Centralized_8.x)/
Partitioned Table/
Partitioned Table O&M Management/
EXCHANGE PARTITION/
Exchanging Level-2 Partitions for a Level-2 Partitioned Table
Updated on 2024-06-07 GMT+08:00
Exchanging Level-2 Partitions for a Level-2 Partitioned Table
You can run ALTER TABLE EXCHANGE SUBPARTITION to exchange level-2 partitions in a level-2 partitioned table.
For example, exchange the level-2 partition date_202001_channel1 of the level-2 partitioned table range_list_sales with the ordinary table exchange_sales by specifying the partition name without validating the partition key, and update the global index.
ALTER TABLE range_list_sales EXCHANGE SUBPARTITION (date_202001_channel1) WITH TABLE exchange_sales WITHOUT VALIDATION UPDATE GLOBAL INDEX;
Alternatively, exchange the level-2 partition corresponding to ('2020-01-08', '0') in the level-2 partitioned table range_list_sales with the ordinary table exchange_sales by specifying a partition value, validate the partition, and insert data that does not meet the target partition constraints into another partition of the partitioned table. Global indexes become invalid after this command is executed because the UPDATE GLOBAL INDEX clause is not used.
ALTER TABLE range_list_sales EXCHANGE SUBPARTITION FOR ('2020-01-08', '0') WITH TABLE exchange_sales WITH VALIDATION VERBOSE;
Partitions in a level-2 partitioned table cannot be exchanged.
Parent topic: EXCHANGE PARTITION
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot