Creating a Range Partition on an Existing Table

You can add range partitioning to an existing unpartitioned table or add additional range partitions to a table that is already range partitioned.

Prerequisites
Database Version Table Partition Privileges
SAP Sybase IQ 15.3 and 15.4 You must have one of:
  • DBA authority
  • CREATE permission on the dbspaces where the partitions are being created

You must also have one of:

  • ALTER permission on the table
  • You own the table
SAP Sybase IQ 16.0 You must have one of:
  • ALTER ANY OBJECT system privilege
  • CREATE permission on the dbspaces along with one of:
    • ALTER ANY TABLE system privilege
    • ALTER permission on the table
    • You own the table
Task
When adding range partitioning to an unpartitioned table, if the table contains data, all data must fit within the initial partition constraint. For example, if the partition key pertains to age, and the highest age in the table is 50, the constraint value must be 50 or higher. If any data exceeds the constraint limit, an error message appears, and the partition is not created.
  1. In the Perspective Resources view, select the resource, and select Resource > Administration Console.
  2. In the left pane, expand IQ Servers > Schema Objects > Tables, and then select Tables.
  3. Select an unpartitioned table or a table with range partitioning from the right pane and either:
    • Click the arrow to the right of the name and select Properties, or
    • From the Administration Console menu bar, select Resource > Properties.
    The Table Properties view appears.
  4. Select Partitions.
    If the table is already partitioned, a list of partitions appears.
  5. Click New.
    The Create Partition Wizard appears.
  6. On the Partition Type page, click Next. Only Range type is allowed.
  7. On the Partition Key page, do one of:
    Option Description
    Table is already partitioned Click Next. This value cannot be changed on a table that is already range partitioned.
    Table is unpartitioned Select a column and click Add. Click Next.
    Note: A partition key cannot contain LOB, binary, varbinary, bit, float, double, or real data, or any char or varchar column with a length that exceeds 255 bytes.
  8. On the Partitions page, click Add. The Define a Partition view appears. Specify:
    • Name – enter a descriptive name for the partition.
    • Constraint – (read only) less than or equal (<=) is the only constraint currently supported.
    • Value – enter a value for the upper boundary of the partition. The value must be appropriate for the data type of the partition key.
    • Dbspace – select the dbspace for the partition from the drop-down.

    Click OK. Repeat this step to add additional partitions.

    Note:
    • When adding multiple partitions to a table, the constraint value of each successive partition must be greater than that of the previous partition. For example, if the constraint value of the first partition is 100, the constraint value of the next partition must be 101 or higher.

    • If an invalid constraint value is specified, no error message appears when you click OK on the Define a Partition dialog, but does appear when you click OK or Apply to complete the partitioning process.

  9. Click Next.
  10. (Optional) On the Columns page, if you want to store the data for any individual columns in separate dbspaces from the partition, click Add. Choose the column, partition, and dbspace from each drop-down list, and click OK. Repeat this step to specify additional columns to be stored separately from the dbspaces of their respective partitions.
  11. Click Finish to return to the Table Properties Partitions page.
  12. Do one of:
    • Click OK to update any changes to the database and exit the properties view.
    • Click Apply to update any changes to the database, but remain in the properties view.
    • Click Cancel to cancel any changes not updated to the database and exit the properties view.
      Note: If an error is detected with a constraint (partition bound) value, an error message appears. Highlight the invalid partition and do one of:
      • Click Edit, correct the value, and click OK.
      • Click Delete to remove the invalid partition.
      Click Apply or OK to complete the partitioning process.
Related tasks
Creating a Range Subpartition to an Existing Hash-Range Partitioned Table
Deleting a Range Partition or Subpartition
Unpartitioning a Table
Rebuilding a Hash or Hash-Range Partitioned Table
Merging Partitions
Splitting a Partition
Moving a Partition
Managing Column Storage in a Table Partition
Viewing or Modifying Table Partition Properties
Authenticating a Login Account for a Managed Resource
Related reference
Table Partition Privilege Summary