40 High-Function Business Intelligence in e-business
SQL statements will only be able to access the SALES table data prior to the
beginning of the first loaded page
(because of the ALLOW READ ACCESS
option), and also be able to use SALES_SUM and SALES_SUM_REGION for
optimization because they are still in sync. This has expanded the window of
availability of the materialized view and base table.
3. At the end of the load, SALES still has the CHECK PENDING READ
ACCESS state set.
4. Next
11
a SET INTEGRITY SALES ....IMMEDIATE CHECKED....is issued for
verifying the integrity of the new data loaded. This takes an exclusive lock on
SALES and puts it into a NO DATA MOVEMENT state, and also puts the
SALES_SUM and SALES_SUM_REGION materialized views in a CHECK
PENDING NO ACCESS state. STORE_SALES will remain in normal state
since the rows added do not affect the referential integrity relationship with
STORE_SALES. The PRODUCT table is also unaffected by the rows added
to SALES and is therefore left in normal state.
At this point, materialized view optimization will be suspended because both
the SALES_SUM and SALES_SUM_REGION materialized views are in
CHECK PENDING NO ACCESS state.
5. Assuming a successful SET INTEGRITY SALES step, we issue a REFRESH
TABLE SALES_SUM statement which results in an incremental update using
only the data after the first loaded page, which is a much faster operation than
scanning the entire base table. This reduces the window of availability of the
SALES_SUM materialized view as well. When this refresh is completed
successfully, the CHECK PENDING NO ACCESS state is reset on
SALES_SUM, but not on SALES_SUM _REGION which has not been
refreshed as yet. SALES continues to be in the NO DATA MOVEMENT state.
6. Now a REFRESH TABLE SALES_SUM_REGION causes that table to be
taken out of CHECK PENDING NO ACCESS state and available for
11
The SET INTEGRITY step is not required if the base table has no parent tables, descendent
tables, check constraints, or generated columns.
Note: SET INTEGRITY SALES will cause local check constraints to be
verified, as well as referential integrity violations checked against the
PRODUCT table. These checks may fail, which would result in states being
rolled back to the way it was at the end of the load.
Note: SALES_SUM materialized view is now available for optimization,
while SALES_SUM_REGION is not, since it is in CHECK PENDING NO
ACCESS state.