Creating custom indexes manually
If the target database of your 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.
- When tables are created in a target database, an alias table and one or more table views are created at the same time. You have to make sure that you create manual indexes on the tables, and not the aliases or views. Especially the aliases can be hard to distinguish from the tables because their names might be exactly the same.
- Data Gate does not save the indexes you create. After reloading a target table, you must create its index again. For Data Gate versions on Cloud Pak for Data 4.8.x, you can avoid this by using custom index templates. See Preserving custom indexes for more information. It describes the recommended way to create custom indexes. The procedure in this topic is recommended only if you do not want to fully reload the tables to be indexed.
Follow the procedure to create target table indexes manually:
Procedure
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.