Refreshing a system-maintained materialized query table
You can use the REFRESH TABLE statement to refresh the data in any materialized query table at any time.
Procedure
To refresh an existing materialized query table:
Issue a REFRESH TABLE statement.
When you issue
the REFRESH TABLE statement Db2 performs the
following actions:
- Deletes all the rows in the materialized query table
- Executes the fullselect in the materialized query table definition to recalculate the data from the tables that are specified in the fullselect with the isolation level for the materialized query table
- Inserts the calculated result into the materialized query table
- Updates the Db2 catalog with a refresh timestamp and the cardinality of the materialized query table
Although the REFRESH TABLE statement involves both deleting and inserting data, Db2 completes these operations in a single commit scope. Therefore, if a failure occurs during execution of the REFRESH TABLE statement, Db2 rolls back all changes that the statement made.