Configuring automatic query rewrite

You can enable Db2 to rewrite certain queries to use materialized query tables instead of base tables for faster processing.

Procedure

Begin program-specific programming interface information. To take advantage of automatic query rewrite with materialized query tables:

  1. Define materialized query tables.
  2. Populate materialized query tables.
  3. Refresh materialized query tables periodically to maintain data currency with base tables.
    However, realize that refreshing materialized query tables can be an expensive process.
  4. Enable automatic query rewrite, and exploit its functions by submitting read-only dynamic queries.
  5. Evaluate the effectiveness of the materialized query tables. Drop under-used tables, and create new tables as necessary.
    End program-specific programming interface information.