Examples
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Migrating an unpartitioned table to a partitioned table
The ALTER TABLE statement in the following example migrates data of
an unpartitioned table to a partitioned table. The table in the example contains
three columns and three indexes (out of which two are partition aligned):
|
The above ALTER TABLE statement creates partition definition of the
table with the data in the composite initial partition. All the three newly added
partitions point to the composite initial partition. The data can be accessed
normally.
The following ALTER TABLE SPLIT statement marks all the three
partitions as ready to be split. After the statement is executed, the data access to
these partitions results in an error.
|
The following statement moves the data to its respective partitions. At this stage,
each partition contains three rows and the table is completely partitioned with
three LIST partitions.
|
Migrating data of an unpartitioned table to a RANGE partitioned table
The following statement creates a table with four indexes, out of which, the first two are partition aligned.
The below statement alters the table to have a single RANGE
partition:
|
|
At this stage table is partitioned with a single partition definition
partn_2k, and all data is accessible.
The below statement add a new partition to have values less than or equal to 1000 and marks the partition as the split target:
|
The below statement uses the PROUTIL utility to move data from the
composite initial partition to target partition partn_1k.
|
The above statement moves the rows satisfying condition custid<=1000 into a newly added partition. Now, the table contains one physical partition containing values <= 1000 and one composite partition contains values <= 2000 and > 1000.
The following statement splits without any partition definitions to move rest of data from the composite partition:
|
The above statement marks partn_2k as the split target. Running the
utility will move remaining records from the composite partition to
partn_2k. In this case four records will be moved.
Migrating an unpartitioned table to a LIST-LIST partitioned table
|
The below statement marks all the partitions specified above as split targets:
|
Executing the PROUTIL utility, now, moves data from the composite
initial partition to the target partition.
Migrating an unpartitioned table to a LIST-RANGE partitioned table
|
In the above statement, the maximum value for the RANGE partition
key column (custid) is specified for each leading
LIST key column (zipcode)value.
The below statement further splits the sub_customer_range1
partition:
|
The below statement marks the sub_customer_range1 partition as the
split target:
|