Chapter 2. DB2 UDB’s materialized views 31
The PROPAGATE IMMEDIATE parameter in the CREATE TABLE statement
indicates that any changes made to the base tables as part of an INSERT,
DELETE, UPDATE operation are immediately added to the staging table, with
additional information generated in the three extra columns of the staging
table.This is done as part of the same SQL statement.
The schema of the staging table looks much like the materialized view for which it
has been defined. The difference is that the staging table may have two or three
more columns than its associated materialized view. These additional columns
are as follows:
? GLOBALTRANSID CHAR(8) — global transaction ID for each propagated row
? GLOBALTRANSTIME CHAR(13) — the timestamp of the transaction
? OPERATIONTYPE INT — values -1, 0 and 1 for SQL DELETE, UPDATE and
INSERT respectively
For replicated
7
materialized views and non-aggregate query materialized views,
the staging table contains three more columns than the associated materialized
view. Otherwise, the staging table only contains two extra columns, with the
OPERATIONTYPE column being omitted.
Step 2
Issuing the SET INTEGRITY statement against the staging table takes it out of
the CHECK PENDING NO ACCESS state, thus making it available for
processing.
Step 3
Issuing the REFRESH TABLE statement against the materialized view
sales_summary with the NOT INCREMENTAL option, populates the materialized
view and takes it out of CHECK PENDING NO ACCESS state on successful
completion.
Step 4
This step reflects ongoing update activity against the underlying base tables. For
SQL operations, the staging table is updated synchronously within the same unit
of work as the SQL INSERT, UPDATE or DELETE statement.
Restriction: Each column name in the staging table must be unique and
unqualified. If a list of column names is not specified, the columns of the table
inherit the names of the columns of the associated summary table and the
additional columns are defined. If a list of columns is specified, it has to
include the required extra columns.
7
This applies to a partitioned database environment.