The DB2 optimizer is an advanced, cost-based optimizer and normally chooses very efficient access plans. However, to enable the optimizer to choose an efficient plan, ensure that:

  • The tables are indexed correctly for the workload

  • The table and index statistics are current

  • The optimization level is set correctly based on the workload

  • Parallelism is enabled only if the workload will benefit from it