Create a partition
These instructions assume that you are partitioning an exisiting table. To create a table, see Create a table. You can partition a table by hash, which will divide the table into the specified number of equally sized partitions. Or, you can partition by range, which allows you to specify the rows where each partition will begin and end.
To partition by hash:
- In the System i Navigator window, expand the system you want to use.
- Expand Databases and the database that you want to work with.
- Expand Schemas and the schema you want to work with.
- Select Tables. The existing tables appear in the right pane.
- Right-click the table to partition and select Definition.
- On the Table definition dialog, select the Partitioning tab.
- Select Partition by hash.
- Specify the number of partitions to create in the Number of partitions field. You may create up to 256 partitions.
- Specify the partition key columns by selecting them from the list of available columns, then click Add.
- Click OK.
To partition by range:
- In the System i Navigator window, expand the system you want to use.
- Expand Databases and the database that you want to work with.
- Expand Schemas and the schema you want to work with.
- Select Tables. The existing tables appear in the right pane.
- Right-click the table to partition and select Definition.
- On the Table definition dialog, select the Partitioning tab.
- Select Partition by range.
- Specify the partition key columns by selecting them from the list of available columns, then click Add.
- Use Set Null Values to define where to position null values. Select the key column in the Selected Columns area , then click the Set Null Values button repeatedly to select an option:
- Nulls First will place the null values before the first valid value for the datatype.
- Nulls Last will place the null values after the last valid value for the datatype.
Your choice is displayed in the Null Values column. If you select to leave this column blank, the null values are not sorted.
- Define you partitions by clicking Add... in the Partitions area. This will open the New Table Partition dialog.
- On the New Table Partition dialog, specify either a partition name or partition number (not both) to identify the partition. Or, you can use the system-generated values.
- Specify a beginning point for the partition in the Start Value field. If you want the partition to include the start value, select the Include range key start values option. To exclude the start value from the partition, deselect this option.
- Specify an ending point for the partition in the End Value field. If you want the partition to include the end value, select the Include range key end values option. To exclude the end value from the partition, deselect this option.
Note: Your selections for including or excluding range key values will apply to all partitions in the table.
- Click OK. The partition you created is shown in the Partitions area of the Partitioning tab.
- Repeat steps 8-13 to define additional partitions. You may create up to 256 partitions. Use the Move Up and Move Down buttons to change the order in which the partitions are displayed.
- When you are finished creating partitions, click OK on the Table definition dialog.