ALTER TABLE syntax to add or drop partitions
- Last Updated: December 12, 2014
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Use the following syntax to add or drop partitions to or from a partitioned table:
Syntax
|
Parameters
- column_values
-
Uses the following syntax:
column_value[ , column_value, ...]- column_value
-
Uses a constant as its value
- RO_RW_ATTRIBUTE
-
Uses the following syntax and marks the partition as a read-only partition or a read-write partition:
READ_ONLY | READ_WRITEIf
RO_RW_Attributeis not specified, then by default, the partition is marked as a read-write partition.
Notes
The following
semantics apply when using ALTER TABLE to add and
drop partitions:
- The table specified in the syntax must be a partitioned table
- In case of a table partitioned by
LIST, the new partition must be specified with key values that are not already defined - In case of a table partitioned by
RANGEwith data, the newRANGEpartition can be added with aRANGEkey value greater than the existing maximum key value of the table - If the table is empty, new
RANGEpartitions can be added within the defined partition key values - The partition to be dropped must be empty and must not be allocated
- The database truncate utility must be used to remove data from
the partition and no allocation must be assigned to it before executing
the
ALTER TABLE DROPsyntax - The last partition can also be dropped
- To drop a partition, the table must contain the partition name specified
- To drop multiple partitions, the partition names must be specified in a comma-separated list and the table must contain those partitions
- Dropping a partition is not allowed when split, merge, or other database utilities are operating on a partition
- Dropping a partition which is referring to the initial composite partition is not allowed
- Dropping a partition is not allowed when it is marked as ready to be split
- Dropping a partition is not allowed when it is the source for a split operation
- A read-only partition cannot be deallocated, hence cannot be dropped.
Examples
Adding RANGE partitions
The following example illustrates adding
RANGE partitions. |
The below statement adds a partition with
values <= 30000.
|
Note: Adding new partition whose
key values are less than the existing
RANGE key
values is allowed since the table does not contain any data.The
below statement adds two partitions whose values are <= 40000
and <= 90000, respectively:
|
Adding partitions to a subpartitioned table
The below example shows how to add partitions to
a subpartitioned table:
|
Adding LIST partitions
The
following example illustrates adding
LIST partitions: |
The below statement adds two new partitions:
|
Adding read-only partitions
The following example illustrates adding a read-only partition:
|
Adding read-write partitions
The following example illustrates adding a read-write partition:
|
Dropping partitions
The following
example illustrates dropping a single partition:
|
The following example illustrates dropping
multiple partitions:
|