Creating indexes manually
If the target database of your Db2 Data Gate setup is Db2, indexes on the target tables are created automatically when you load the tables. However, if these indexes do not satisfy your needs, you can manually create indexes for your target tables.
About this task
The automatically created table indexes aim for an optimization of the synchronization process with regard to the deletion of records from the target database.
No indexes are imported or migrated from the Db2 for z/OS® source tables.
For Db2 target databases, the automatic index creation follows these selection rules:
- The unique constraints of the table are identified.
- Possible indexes are identified. These must include one of the unique constraints, and be among the possible choices with the lowest number of non-nullable columns.
- From the possible indexes identified in step 2, one of the indexes with the lowest overall number of columns is selected.
An automatic index creation does not exist for tables in Db2 Warehouse target databases.
If the automatically created index does not meet your (performance) requirements, you can manually create indexes of your own choosing.
In the case of a Db2 target database, an index with fewer columns might reduce the time needed for synchronization or table load processes.
On the contrary, synchronization and table load processes might slow down if you increase the overall number of indexes on a table. So you have to decide what is more important to you: faster synchronization and load, or faster query execution.
Follow the procedure to create target table indexes manually:
Procedure
Db2 Data Gate does not expose the names of the target tables. To create an index, you must therefore identify the underlying table names first. To this end, you can use db2look, which is a tool provided by your target database.