TARGET
When repartitioning data, specify the TARGET option to identify the database partition characteristics of the target table.
The file name of each of the output files contains the specified database partition number of the target table in the following format: base_filename.target_partition_number. The base_filename is set in the output_file clause. You can use the Db2 Load command on the target database with these output files.
Depending on your approach to repartitioning, you can choose either the KEYS or the TABLE option.
KEYS option parameters
Use the KEYS option to identify the column or columns that will comprise the partitioning key of the target table and the desired database partition numbers in the target table's instance. These values are used when you create the database partition map for the target table. The KEYS option accepts two parameters.
- Column list
- The column list parameter of the TARGET KEYS option is required and specifies the columns that comprise the partitioning key. You can choose either CURRENT, DEFAULT, or a comma-separated list of column names or numbers.
- PARTS
- The PARTS parameter is optional. It identifies the database partition numbers that are used when Optim High Performance Unload creates a database partition map for the target table. The parameter can take the value for a single database partition, a comma-separated list of database partition numbers, a range (for example,
4:8includes database partitions 4 through 8), a combination of these options, the keyword ALL or the keyword IN plus a filename. The database partition default is PARTS ALL. If you choose the DEFAULT option with PARTS ALL, the generated database partition map will reflect the list of database partition numbers of the database partition group associated with the table space in which the source table is defined. If you select an explicit list of database partition numbers or use the ALL option, the database partition numbers will be listed in round robin order (for example: 1,2,3,1,2,3,1,2,3,1...). If you select the IN option, you must specify a file location, corresponding to a file which has been generated by the db2gpmap Db2 utility. - "filename"
- This required lexeme corresponds to the external file where the partition map definition was extracted with the db2gpmap Db2 utility.
- Syntax
TARGET KEYS (DEFAULT | CURRENT | (column list) [PARTS (ALL) | (database partition list) | IN "filename"])- Variable
- column list- The list of column names or numbers.
- Default
- No default for column list. ALL if PARTS is not specified.
TABLE option parameters
Use the TABLE option to identify a table to be used as a model that has the partitioning characteristics that you choose. This existing model table does not have to be in the same database, but it must be in the same Db2 instance. This model table must have the same partitioning key and database partition numbers as the intended target table. The parameter is the name of the model table to be used as the database partition map model. Optionally, it can be prefixed with a qualifying schema or creator ID. If this table resides in a different database, it is followed by the keyword IN and the name of the database.
- Syntax
TARGET TABLE (model_table)- Variables
- database, creator, and model_table.
- Default
- None.
- Do not attempt to change the database partition number in the output file name after running an unload.
- See the Db2 SQL Reference Guide for additional information on partitioning keys and database partition maps.