Automatic Range Partitioning
The partition created by automatic range partitioning is an interval partition. To enable automatic range partitioning, you need to specify the INTERVAL clause when creating partitions. Currently, only level-1 interval partitioned tables and single-column partition keys are supported.
-- Create a partitioned table and specify the INTERVAL clause, indicating that automatic range partitioning is supported. gaussdb=# CREATE TABLE interval_int (c1 int, c2 int) PARTITION BY RANGE (c1) INTERVAL (5) ( PARTITION p1 VALUES LESS THAN (5), PARTITION p2 VALUES LESS THAN (10), PARTITION p3 VALUES LESS THAN (15) );
If the inserted data cannot match any existing partition, a partition is automatically created. The range definition of the new partition is determined by the previous partition range and the INTERVAL value.
-- Insert data 23 into the partition key. The sys_p1 partition is automatically created, and the partition range is defined as [20,25). gaussdb=# INSERT INTO interval_int VALUES (23, 0); -- Cleanup example gaussdb=# DROP TABLE interval_int;
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot