Creating and using materialized query tables
An MQT is based on a query and is much the same as a view, but the data retrieved from the query is stored in this MQT for later use. We can then query this table directly, as if it were a regular table.
An MQT can be defined as managed by the user, or by the system, which is the option we will use in our example. We'll discuss both the options later.
On table creation, you have to specify one of two refresh methods for this MQT:
DEFERRED
: Data in the MQT can be refreshed at any time with theREFRESH TABLE
command. The refresh table will take a snapshot of the query's result set. Changes made on the underlying tables are not reflected until the next refresh.IMMEDIATE
: Once the table is created, no other intervention is necessary. When changes are made to the underlying tables, the changes are applied to the MQT automatically, and any subsequent query will reflect the changes.
Getting ready
Estimate or get the actual number of records retrieved by...