Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 | 

Adding Range Partitions

Description

You can add range partitions by using the ADD PARTITION clause of the ALTER statement.

Syntax

ALTER {TABLE | CLASS} <table_name>
ADD PARTITION <partition definitions comma list>
partition definition comma list:
PARTITION <partition_name> VALUES LESS THAN ( <range_value> ),...

  • table_name : Specifies the name of the table to which partitions are added.
  • partition definition comma list : Specifies the partitions to be added. Multiple partitions are separated by commas (,).
Example

Currently, the partition before the 2008 Olympic Games is defined in the participant2 table. The following is an example of adding the before_2012 and before_2016 partitions; the former will store the information about the 2012 Olympic Games and the latter will store the information about the 2016 Olympic Games.

ALTER TABLE participant2 ADD PARTITION (
PARTITION before_2012 VALUES LESS THAN (2012),
PARTITION before_2016 VALUES LESS THAN MAXVALUE );

Caution
  • When a range partition is added, only the partition by value greater than the existing partition value can be added. Therefore, as shown in the above example, if the maximum value is specified by MAXVALUE, no more partitions can be added (you can add partitions by changing the MAXVALUE value by redefining the partition).
  • To add the partition by value smaller than the existing partition value, use the redefining partitions (see "Redefining Range Partitions").