Creating Materialized Query Tables

User-maintained MQTs are created with the CREATE TABLE statement. For example:

						DB2 CREATE TABLE example AS (SELECT C1, C2 FROM T1) DATA INITIALLY DEFERRED REFRESH
 DEFERRED MAINTAINED BY USER
					

Because this MQT has not yet been populated, it is placed in the CHECK PENDING NO ACCESS state. No SQL read or write access is permitted against tables in a CHECK PENDING NO ACCESS state.

User-maintained MQTs can only be defined as REFRESH DEFERRED. It is the responsibility of the user to ensure that the data in this table is kept up to date.

Get DB2® Version 8: The Official Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.