| See Also:
Oracle9i Replication and Oracle9i Heterogeneous Connectivity Administrator's Guide for details on distributed and mobile computing
|
| See Also:
Oracle9i Replication and Oracle9i Heterogeneous Connectivity Administrator's Guide for details on distributed and mobile computing
|
SUM,
or both. These operations are expensive in terms of time and processing
power. The type of materialized view you create determines how the
materialized view is refreshed and used by query rewrite.CREATE SNAPSHOT statement. Now CREATE MATERIALIZED VIEW is a synonym for CREATE SNAPSHOT.SUM, COUNT(x), COUNT(*), COUNT(DISTINCT x), AVG, VARIANCE, STDDEV, MIN, and MAX).
It can also include any number of joins. If you are unsure of which
materialized views to create, Oracle provides a set of advisory
procedures in the DBMS_OLAP package to help in designing
and evaluating materialized views for query rewrite. These functions are
also known as the Summary Advisor or the Advisor. Note that the OLAP
Summary Advisor is different. See Oracle9i OLAP User's Guide for further details regarding the OLAP Summary Advisor.SELECT statement.|
Note:
The techniques shown in this chapter illustrate how to use
materialized views in data warehouses. Materialized views can also be
used by Oracle Replication. See Oracle9i Replication for further information.
|
DBMS_OLAP
package. Collectively, these functions are called the Summary Advisor,
and are also available as part of Oracle Enterprise Manager.
| See Also:
Chapter 16, "Summary Advisor" and Oracle9i OLAP User's Guide for OLAP-related schemas
|
fact.sales.fact.revenues - fact.expenses.fact_a.revenues - fact_b.expenses.NOVALIDATE and RELY
options if the relationships represented by the constraints are
guaranteed by other means. Note that if the joins between fact and
dimension tables do not support the parent-child relationship described
previously, you still gain significant performance advantages from
defining the dimension with the CREATE DIMENSION
statement. Another alternative, subject to some restrictions, is to use
outer joins in the materialized view definition (that is, in the CREATE MATERIALIZED VIEW statement).| See Also:
Chapter 9, "Dimensions" and Oracle9i OLAP User's Guide for OLAP-related schemas
|
| Schema Guideline | Description |
|---|---|
|
Dimensions
|
Dimensions should either be denormalized (each dimension
contained in one table) or the joins between tables in a normalized or
partially normalized dimension should guarantee that each child-side row
joins with exactly one parent-side row. The benefits of maintaining
this condition are described in "Creating Dimensions".
You can enforce this condition by adding
FOREIGN KEY and NOT NULL constraints on the child-side join keys and PRIMARY KEY constraints on the parent-side join keys. |
|
Dimensions
|
If dimensions are denormalized or partially denormalized,
hierarchical integrity must be maintained between the key columns of the
dimension table. Each child key value must uniquely identify its parent
key value, even if the dimension table is denormalized. Hierarchical
integrity in a denormalized dimension can be verified by calling the
VALIDATE_DIMENSION procedure of the DBMS_OLAP package. |
|
Dimensions
|
Fact and dimension tables should similarly guarantee that
each fact table row joins with exactly one dimension table row. This
condition must be declared, and optionally enforced, by adding
FOREIGN KEY and NOT NULL constraints on the fact key column(s) and PRIMARY KEY
constraints on the dimension key column(s), or by using outer joins. In
a data warehouse, constraints are typically enabled with the NOVALIDATE and RELY clauses to avoid constraint enforcement performance overhead. See Oracle9i SQL Reference for further details. |
|
Incremental Loads
|
Incremental loads of your detail data should be done using
the SQL*Loader direct-path option, or any bulk loader utility that uses
Oracle's direct-path interface. This includes
INSERT ... AS SELECT with the APPEND or PARALLEL hints, where the hints cause the direct loader log to be used during the insert. See Oracle9i SQL Reference and "Types of Materialized Views". |
|
Partitions
|
Range/composite partition your tables by a monotonically increasing time column if possible (preferably of type
DATE). |
|
Dimensions
|
After each load and before refreshing your materialized view, use the
VALIDATE_DIMENSION procedure of the DBMS_MVIEW package to incrementally verify dimensional integrity. |
|
Time Dimensions
|
If a time dimension appears in the materialized view as a
time column, partition and index the materialized view in the same
manner as you have the fact tables.
|
ENABLE NOVALIDATE with the RELY
clause to turn on constraint checking without validating any of the
existing constraints. The risk with this approach is that incorrect
query results could occur if any constraints are broken. Therefore, as
the designer, you must determine how clean the data is and whether the
risk of wrong results is too great.DIRECT or PARALLEL option or to use another loader tool that uses the Oracle direct-path API.| See Also:
Oracle9i Database Utilities for the restrictions and considerations when using SQL*Loader with the
DIRECT or PARALLEL keywords |
INSERT AS SELECT with the PARALLEL or APPEND hint.NOVALIDATE option.ALTER SYSTEM SET QUERY_REWRITE_ENABLED = false statement until all the materialized views are refreshed.QUERY_REWRITE_INTEGRITY is set to stale_tolerated,
access to the materialized view can be allowed at the session level to
any users who do not require the materialized views to reflect the data
from the latest load by issuing an ALTER SESSION SET QUERY_REWRITE_INTEGRITY=true statement. This scenario does not apply when QUERY_REWRITE_INTEGRITY is either enforced or trusted because the system ensures in these modes that only materialized views with updated data participate in a query rewrite.SELECT clause in the materialized view
creation statement defines the data that the materialized view is to
contain. Only a few restrictions limit what can be specified. Any number
of tables can be joined together. However, they cannot be remote tables
if you wish to take advantage of query rewrite. Besides tables, other
elements such as views, inline views (subqueries in the FROM clause of a SELECT statement), subqueries, and materialized views can all be joined or referenced in the SELECT clause.SELECT list must contain all of the GROUP BY columns (if present), and there must be a COUNT(*) and a COUNT(column)
on any aggregated columns. Also, materialized view logs must be present
on all tables referenced in the query that defines the materialized
view. The valid aggregate functions are: SUM, COUNT(x), COUNT(*), AVG, VARIANCE, STDDEV, MIN, and MAX, and the expression to be aggregated can be any SQL value expression.INSERT, UPDATE, or DELETE). It can be defined to be refreshed ON COMMIT or ON DEMAND. A REFRESH ON COMMIT,
materialized view will be refreshed automatically when a transaction
that does DML to one of the materialized view's detail tables commits.
The time taken to complete the commit may be slightly longer than usual
when this method is chosen. This is because the refresh operation is
performed as part of the commit process. Therefore, this method may not
be suitable if many users are concurrently changing the tables upon
which the materialized view is based.CREATE MATERIALIZED VIEW LOG ON products WITH SEQUENCE, ROWID (prod_id, prod_name, prod_desc, prod_subcategory, prod_subcat_desc, prod_ category, prod_cat_desc, prod_weight_class, prod_unit_of_measure, prod_pack_ size, supplier_id, prod_status, prod_list_price, prod_min_price) INCLUDING NEW VALUES; CREATE MATERIALIZED VIEW LOG ON sales WITH SEQUENCE, ROWID (prod_id, cust_id, time_id, channel_id, promo_id, quantity_sold, amount_sold) INCLUDING NEW VALUES; CREATE MATERIALIZED VIEW product_sales_mv PCTFREE 0 TABLESPACE demo STORAGE (INITIAL 8k NEXT 8k PCTINCREASE 0) BUILD IMMEDIATE REFRESH FAST ENABLE QUERY REWRITE AS SELECT p.prod_name, SUM(amount_sold) AS dollar_sales, COUNT(*) AS cnt, COUNT(amount_sold) AS cnt_amt FROM sales s, products p WHERE s.prod_id = p.prod_id GROUP BY prod_name;
product_sales_mv that computes total number and value of sales for a product. It is derived by joining the tables sales and products on the column prod_id.
The materialized view is populated with data immediately because the
build method is immediate and it is available for use by query rewrite.
In this example, the default refresh method is FAST, which is allowed because the appropriate materialized view logs have been created on tables product and sales.CREATE MATERIALIZED VIEW product_sales_mv PCTFREE 0 TABLESPACE demo STORAGE (INITIAL 16k NEXT 16k PCTINCREASE 0) BUILD DEFERRED REFRESH COMPLETE ON DEMAND ENABLE QUERY REWRITE AS SELECT p.prod_name, SUM(amount_sold) AS dollar_sales FROM sales s, products p WHERE s.prod_id = p.prod_id GROUP BY p.prod_name;
product_sales_mv that computes the sum of sales by prod_name. It is derived by joining the tables store and fact on the column store_key. The materialized view does not initially contain any data, because the build method is DEFERRED.
A complete refresh is required for the first refresh of a build
deferred materialized view. When it is refreshed and once populated,
this materialized view can be used by query rewrite.CREATE MATERIALIZED VIEW LOG ON sales WITH SEQUENCE, ROWID (prod_id, cust_id, time_id, channel_id, promo_id, quantity_sold, amount_sold) INCLUDING NEW VALUES; CREATE MATERIALIZED VIEW sum_sales PARALLEL BUILD IMMEDIATE REFRESH FAST ON COMMIT AS SELECT s.prod_id, s.time_id, COUNT(*) AS count_grp, SUM(s.amount_sold) AS sum_dollar_sales, COUNT(s.amount_sold) AS count_dollar_sales, SUM(s.quantity_sold) AS sum_quantity_sales, COUNT(s.quantity_sold) AS count_quantity_sales FROM sales s GROUP BY s.prod_id, s.time_id;
sales table, then the changes will be reflected in the materialized view when the commit is issued.COUNT(*) must always be present. Oracle recommends that you include the optional aggregates in column Z in the materialized view in order to obtain the most efficient and accurate fast refresh of the aggregates.sales table to the times and customers tables. The advantage of creating this type of materialized view is that expensive joins will be precalculated.INSERT, UPDATE, or DELETE).ON COMMIT or ON DEMAND. If it is ON COMMIT,
the refresh is performed at commit time of the transaction that does
DML on the materialized view's detail table. Oracle does not allow
self-joins in materialized join views.REFRESH FAST, Oracle performs further verification of the query definition to ensure that fast refresh can be performed if any of the detail tables change. These additional checks are:SELECT list of the materialized view query definition.WHERE clause. However, if there are outer joins, the WHERE clause cannot have any selections. Further, if there are outer joins, all the joins must be connected by ANDs and must use the equality (=) operator.REFRESH FORCE
to take advantage of fast refresh when it is possible. If one of the
tables did not meet all of the criteria, but the other tables did, the
materialized view would still be fast refreshable with respect to the
other tables for which all the criteria are met.CREATE MATERIALIZED VIEW LOG ON sales WITH ROWID; CREATE MATERIALIZED VIEW LOG ON times WITH ROWID; CREATE MATERIALIZED VIEW LOG ON customers WITH ROWID; CREATE MATERIALIZED VIEW detail_sales_mv PARALLEL BUILD IMMEDIATE REFRESH FAST AS SELECT s.rowid "sales_rid", t.rowid "times_rid", c.rowid "customers_rid", c.cust_id, c.cust_last_name, s.amount_sold, s.quantity_sold, s.time_id FROM sales s, times t, customers c WHERE s.cust_id = c.cust_id(+) AND s.time_id = t.time_id(+);
UNIQUE constraints should exist on c.cust_id and t.time_id. You should also create indexes on the columns sales_rid, times_rid, and customers_rid, as illustrated in the following. This will improve the refresh performance.CREATE INDEX mv_ix_salesrid ON detail_sales_mv("sales_rid");
times_rid and customers_id, and if the refresh method was REFRESH FORCE, then this materialized view would be fast refreshable only if the sales table was updated but not if the tables times or customers were updated.CREATE MATERIALIZED VIEW detail_sales_mv PARALLEL BUILD IMMEDIATE REFRESH FORCE AS SELECT s.rowid "sales_rid", c.cust_id, c.cust_last_name, s.amount_sold, s.quantity_sold, s.time_id FROM sales s, times t, customers c WHERE s.cust_id = c.cust_id(+) AND s.time_id = t.time_id(+);
ON COMMIT REFRESH, which is not supported for a nested materialized views that contains joins and aggregates.sh sample schema, the following materialized views illustrate how nested materialized views can be created./* create the materialized view logs */ CREATE MATERIALIZED VIEW LOG ON sales WITH ROWID; CREATE MATERIALIZED VIEW LOG ON customers WITH ROWID; CREATE MATERIALIZED VIEW LOG ON times WITH ROWID; /*create materialized view join_sales_cust_time as fast refreshable at COMMIT time */ CREATE MATERIALIZED VIEW join_sales_cust_time REFRESH FAST ON COMMIT AS SELECT c.cust_id, c.cust_last_name, s.amount_sold, t.time_id, t.day_number_in_week, s.rowid srid, t.rowid trid, c.rowid crid FROM sales s, customers c, times t WHERE s.time_id = t.time_id AND s.cust_id = c.cust_id;
join_sales_cust_time,
you would have to create a materialized view log on the table. Because
this will be a single-table aggregate materialized view on join_sales_cust_time, you need to log all the necessary columns and use the INCLUDING NEW VALUES clause./* create materialized view log on join_sales_cust_time */ CREATE MATERIALIZED VIEW LOG ON join_sales_cust_time WITH ROWID (cust_name, day_number_in_week, amount_sold) INCLUDING NEW VALUES; /* create the single-table aggregate materialized view sum_sales_cust_time on join_sales_cust_time as fast refreshable at COMMIT time */ CREATE MATERIALIZED VIEW sum_sales_cust_time REFRESH FAST ON COMMIT AS SELECT COUNT(*) cnt_all, SUM(amount_sold) sum_sales, COUNT(amount_sold) cnt_sales, cust_last_name, day_number_in_week FROM join_sales_cust_time GROUP BY cust_last_name, day_number_in_week;
ON DEMAND clause is necessary for FAST REFRESH.EXPLAIN_MVIEW
to identify those types of materialized views. Because you have to
invoke the refresh functions manually, ordering has to be taken into
account. This is because the refresh for a materialized view that is
built on other materialized views will use the current state of the
other materialized views, whether they are fresh or not. You can find
the dependent materialized views for a particular object using the
PL/SQL function GET_MV_DEPENDENCIES in the DBMS_MVIEW package.ON COMMIT is not supported for a higher-level materialized view that contains joins and aggregates.DBMS_MVIEW.REFRESH APIs will not automatically refresh nested materialized views unless explicitly specified. Thus, if monthly_sales_mv is based on sales_mv, you have to refresh sales_mv first, followed by monthly_sales_mv. Oracle does not automatically refresh monthly_sales_mv when you refresh sales_mv or vice versa.costs with a materialized view cost_mv based on it, you cannot then create a prebuilt materialized view on table costs. The result would make cost_mv a nested materialized view and this method of conversion is not supported.CREATE MATERIALIZED VIEW statement or using Oracle Enterprise Manager. Example 8-6 creates the materialized view cust_sales_mv.CREATE MATERIALIZED VIEW cust_sales_mv PCTFREE 0 TABLESPACE demo STORAGE (INITIAL 16k NEXT 16k PCTINCREASE 0) PARALLEL BUILD IMMEDIATE REFRESH COMPLETE ENABLE QUERY REWRITE AS SELECT c.cust_last_name, SUM(amount_sold) AS sum_amount_sold FROM customers c, sales s WHERE s.cust_id = c.cust_id GROUP BY c.cust_last_name;
CREATE MATERIALIZED VIEW
statement to create and, optionally, populate the materialized view. If
a user-defined materialized view already exists, then use the ON PREBUILT TABLE clause in the CREATE MATERIALIZED VIEW statement. Otherwise, use the BUILD IMMEDIATE clause to populate the materialized view immediately, or the BUILD DEFERRED clause to populate the materialized view later. A BUILD DEFERRED materialized view is disabled for use by query rewrite until the first REFRESH, after which it will be automatically enabled, provided the ENABLE QUERY REWRITE clause has been specified.
| See Also:
Oracle9i SQL Reference for descriptions of the SQL statements
CREATE MATERIALIZED VIEW, ALTER MATERIALIZED VIEW, and DROP MATERIALIZED VIEW |
sum_of_sales, it could be called sum_of_sales_mv to denote that this is a materialized view and not a table or view.DBMS_OLAP.ESTIMATE_SIZE package, which is described in Chapter 16, "Summary Advisor",
can estimate the number of bytes required to store this uncompressed
materialized view. This information can then assist the design team in
determining the tablespace in which the materialized view should reside.ROLLUP
clause. Data segment compression reduces disk use and memory use
(specifically, the buffer cache), often leading to a better scaleup for
read-only operations. Data segment compression can also speed up query
execution.| See Also:
Oracle9i SQL Reference for a complete description of
STORAGE semantics, Oracle9i Database Performance Tuning Guide and Reference, and Chapter 5, "Parallelism and Partitioning in Data Warehouses" for data segment compression examples |
BUILD IMMEDIATE,
the materialized view definition is added to the schema objects in the
data dictionary, and then the fact or detail tables are scanned
according to the SELECT expression and the results are
stored in the materialized view. Depending on the size of the tables to
be scanned, this build process can take a considerable amount of time.BUILD DEFERRED clause, which creates the materialized view without data, thereby enabling it to be populated at a later date using the DBMS_MVIEW.REFRESH package described in Chapter 14, "Maintaining the Data Warehouse".| Build Method | Description |
|---|---|
BUILD IMMEDIATE |
Create the materialized view and then populate it with data
|
BUILD DEFERRED |
Create the materialized view definition but do not populate it with data
|
DBMS_MVIEW.EXPLAIN_MVIEW. Once the materialized view has been created, you can use DBMS_MVIEW.EXPLAIN_REWRITE to find out if (or why not) it will rewrite a specific query.QUERY_REWRITE_ENABLED initialization parameter to TRUE before using query rewrite. You also must specify the ENABLE QUERY REWRITE clause if the materialized view is to be considered available for rewriting queries.DISABLE QUERY REWRITE when the materialized view is created, the materialized view can subsequently be enabled for query rewrite with the ALTER MATERIALIZED VIEW statement.BUILD DEFERRED, it is not eligible for query rewrite until it is populated with data.DBMS_MVIEW.EXPLAIN_REWRITE
can help provide reasons why a specific query is not eligible for
rewrite. Also, check to see if your materialized view satisfies all of
the following conditions.ROWNUM, SYSDATE, non-repeatable PL/SQL functions, and so on).RAW or LONG RAW datatypes or object REFs.UNION, MINUS, and so on), rewrite will use them for full text match rewrite only.PREBUILT, the precision of the columns must agree with the precision of the corresponding SELECT expressions unless overridden by the WITH REDUCED PRECISION clause.SYS.SELECT and GROUP BY lists, if present, must be the same in the query of the materialized view.AVG(AVG(x)) or AVG(x)+ AVG(x) are not allowed.CONNECT BY clauses are not allowed.ON DEMAND and FORCE.ON COMMIT and ON DEMAND. Depending on the materialized view you create, some of the options may not be available. Table 8-3 describes the refresh modes.ON COMMIT
method, the time required to complete the commit may be slightly longer
than usual. This is because the refresh operation is performed as part
of the commit process. Therefore this method may not be suitable if many
users are concurrently changing the tables upon which the materialized
view is based.ON COMMIT fast refresh rather than ON DEMAND fast refresh.COMMIT time, you must explicitly invoke the refresh procedure using the DBMS_MVIEW
package after addressing the errors specified in the trace files. Until
this is done, the materialized view will no longer be refreshed
automatically at commit time.COMPLETE, FAST, FORCE, and NEVER. Table 8-4 describes the refresh options.DBMS_MVIEW.EXPLAIN_MVIEW to determine whether fast refresh is possible.SYSDATE and ROWNUM.RAW or LONG RAW data types.GROUP BY clauses or aggregates.WHERE clause of the query contains outer joins, then unique constraints must exist on the join columns of the inner join table.WHERE clause. However, if there are outer joins, the WHERE clause cannot have any selections. Furthermore, if there are outer joins, all the joins must be connected by ANDs and must use the equality (=) operator.FROM list must appear in the SELECT list of the query.FROM list of the query.ON COMMIT and ON DEMAND materialized views, however the following restrictions apply:SUM, COUNT, AVG, STDDEV, VARIANCE, MIN and MAX are supported for fast refresh.COUNT(*) must be specified.AGG(expr), the corresponding COUNT(expr) must be present.VARIANCE(expr) or STDDEV(expr) is specified, COUNT(expr) and SUM(expr) must be specified. Oracle recommends that SUM(expr *expr) be specified. See Table 8-1 for further details.SELECT list must contain all GROUP BY columns.MIN or MAX aggregatesSUM(expr) but no COUNT(expr)COUNT(*)COMPATIBILITY parameter must be set to 9.0 if the materialized aggregate view has inline views, outer joins, self joins or grouping sets and FAST REFRESH is specified during creation. Note that all other requirements for fast refresh specified previously must also be satisfied.FROM
clause can be fast refreshed provided the views can be completely
merged. For information on which views will merge, refer to the Oracle9i Database Performance Tuning Guide and Reference.WHERE clause.ANDs and must use the equality (=) operator.CUBE, ROLLUP, Grouping Sets, or concatenation of them, the following restrictions apply:
SELECT list should contain grouping distinguisher that can either be a GROUPING_ID function on all GROUP BY expressions or GROUPING functions one for each GROUP BY expression. For example, if the GROUP BY clause of the materialized view is "GROUP BY CUBE(a, b)", then the SELECT list should contain either "GROUPING_ID(a, b)" or "GROUPING(a) AND GROUPING(b)" for the materialized view to be fast refreshable.GROUP BY should not result in any duplicate groupings. For example, "GROUP BY a, ROLLUP(a, b)" is not fast refreshable because it results in duplicate groupings "(a), (a, b), AND (a)".UNION ALL set operator support the REFRESH FAST option if the following conditions are satisfied:UNION ALL operator at the top level.
UNION ALL operator cannot be embedded inside a subquery, with one exception: The UNION ALL can be in a subquery in the FROM clause provided the defining query is of the form SELECT * FROM (view or subquery with UNION ALL) as in the following example:CREATE VIEW view_with_unionall_mv AS (SELECT c.rowid crid, c.cust_id, 2 umarker FROM customers c WHERE c.cust_last_name = 'Smith' UNION ALL SELECT c.rowid crid, c.cust_id, 3 umarker FROM customers c WHERE c.cust_last_name = 'Jones'); CREATE MATERIALIZED VIEW unionall_inside_view_mv REFRESH FAST ON DEMAND AS SELECT * FROM view_with_unionall;
view_with_unionall_mv satisfies all requirements for fast refresh.UNION ALL
query must satisfy the requirements of a fast refreshable materialized
view with aggregates or a fast refreshable materialized view with joins.
ROWID column has been included in the SELECT list and in the materialized view log. This is shown in the defining query of the view view_with_unionall_mv.SELECT list of each query must include a maintenance column, called a UNION ALL marker. The UNION ALL column must have a distinct constant numeric or string value in each UNION ALL branch. Further, the marker column must appear in the same ordinal position in the SELECT list of each query block.UNION ALL.UNION ALL materialized views.UNION ALL.ORDER BY clause is allowed in the CREATE MATERIALIZED VIEW
statement. It is used only during the initial creation of the
materialized view. It is not used during a full refresh or a fast
refresh.ORDER BY clause. This
initial ordering provides physical clustering of the data. If indexes
are built on the columns by which the materialized view is ordered,
accessing the rows of the materialized view using the index often
reduces the time for disk I/O due to the physical clustering.ORDER BY clause is not
considered part of the materialized view definition. As a result, there
is no difference in the manner in which Oracle detects the various types
of materialized views (for example, materialized join views with no
aggregates). For the same reason, query rewrite is not affected by the ORDER BY clause. This feature is similar to the CREATE TABLE ... ORDER BY capability that exists in Oracle.CREATE MATERIALIZED VIEW LOG
statement on the base table that is to be changed. They are not created
on the materialized view. For fast refresh of materialized views, the
definition of the materialized view logs must specify the ROWID
clause. In addition, for aggregate materialized views, it must also
contain every column in the table referenced in the materialized view,
the INCLUDING NEW VALUES clause and the SEQUENCE clause.sales.CREATE MATERIALIZED VIEW LOG ON sales WITH ROWID (prod_id, cust_id, time_id, channel_id, promo_id, quantity_sold, amount_sold) INCLUDING NEW VALUES;
SEQUENCE
be included in your materialized view log statement unless you are sure
that you will never perform a mixed DML operation (a combination of INSERT, UPDATE, or DELETE operations on multiple tables).ON COMMIT or ON DEMAND.ON COMMIT,
the mixed DML statements occur within the same transaction because the
refresh of the materialized view will occur upon commit of this
transaction.ON DEMAND,
the mixed DML statements occur between refreshes. The following example
of a materialized view log illustrates where one is created on the
table sales that includes the SEQUENCE keyword:
CREATE MATERIALIZED VIEW LOG ON sales WITH SEQUENCE, ROWID (prod_id, cust_id, time_id, channel_id, promo_id, quantity_sold, amount_sold) INCLUDING NEW VALUES;
| See Also:
Oracle Enterprise Manager Configuration Guide and Chapter 16, "Summary Advisor" for further information
|
SELECT
list of a materialized view, or inside an aggregate of a materialized
aggregate view. This restriction does not apply to expressions that
involve only numeric data, for example, a+b where a and b are numeric fields.CREATE MATERIALIZED VIEW ... ON PREBUILT TABLE
statement. Once registered, the materialized view can be used for query
rewrites or maintained by one of the refresh methods, or both.WITH REDUCED PRECISION to allow the precision of columns in the defining query to be different from that of the table columns.NOT NULL constraints unless they also have default values.QUERY_REWRITE_INTEGRITY is set to at least the level of stale_tolerated or trusted.| See Also:
Chapter 22, "Query Rewrite" for details about integrity levels
|
QUERY_REWRITE_INTEGRITY must be set to at least stale_tolerated because, when it is created, the materialized view is marked as unknown. Therefore, only stale integrity modes can be used.sum_sales_tab is eligible for use in query rewrite.CREATE TABLE sum_sales_tab PCTFREE 0 TABLESPACE demo STORAGE (INITIAL 16k NEXT 16k PCTINCREASE 0) AS SELECT s.prod_id, SUM(amount_sold) AS dollar_sales, SUM(quantity_sold) AS unit_sales FROM sales s GROUP BY s.prod_id; CREATE MATERIALIZED VIEW sum_sales_tab ON PREBUILT TABLE WITHOUT REDUCED PRECISION ENABLE QUERY REWRITE AS SELECT s.prod_id, SUM(amount_sold) AS dollar_sales, SUM(quantity_sold) AS unit_sales FROM sales s GROUP BY s.prod_id;
| See Also:
Chapter 5, "Parallelism and Partitioning in Data Warehouses" for further details about partitioning
|
QUERY_REWRITE_INTEGRITY=ENFORCED or TRUSTED modes.DBMS_MVIEW.PMARKER function.GROUP BY clause, the partition key column or the partition marker must be present in the GROUP BY clause.COMPATIBILITY initialization parameter must be a minimum of 9.0.0.0.0.UNION ALL materialized views.GROUP BY is used, in the GROUP BY
list. Depending on the desired level of aggregation and the distinct
cardinalities of the partition key columns, this has the unfortunate
effect of significantly increasing the cardinality of the materialized
view. For example, say a popular metric is the revenue generated by a
product during a given year. If the sales table were partitioned by time_id, it would be a required field in the SELECT clause and the GROUP BY
clause of the materialized view. If there were 1000 different products
sold each day, it would substantially increase the number of rows in the
materialized view.DBMS_MVIEW.PMARKER function is designed to significantly reduce the cardinality of the materialized view (see Example 8-7
for an example). The function returns a partition identifier that
uniquely identifies the partition for a specified row within a specified
partition table. The DBMS_MVIEW.PMARKER function is used instead of the partition key column in the SELECT and GROUP BY clauses.DBMS_MVIEW.PMARKER does not prevent rewrite with that materialized view even when the rewrite mode is QUERY_REWRITE_INTEGRITY=enforced.sh sample schema and the three detail tables sales, products, and times to create two materialized views. For this example, sales is a partitioned table using the time_id column and products is partitioned by the prod_category column. times is not a partitioned table.time_id in the materialized view will not unacceptably
increase the number of rows stored. However, most orders are large and
contain many different products. With approximately 1000 different
products sold each day, including the time_id in the materialized view would substantially increase the cardinality. This materialized view uses the DBMS_MVIEW.PMARKER function.FAST REFRESH.CREATE MATERIALIZED VIEW LOG ON SALES WITH ROWID (prod_id, time_id, quantity_sold, amount_sold) INCLUDING NEW VALUES; CREATE MATERIALIZED VIEW LOG ON PRODUCTS WITH ROWID (prod_id, prod_name, prod_desc) INCLUDING NEW VALUES; CREATE MATERIALIZED VIEW LOG ON TIMES WITH ROWID (time_id, calendar_month_name, calendar_year) INCLUDING NEW VALUES; CREATE MATERIALIZED VIEW cust_mth_sales_mv BUILD DEFERRED REFRESH FAST ON DEMAND ENABLE QUERY REWRITE AS SELECT s.time_id, p.prod_id, SUM(s.quantity_sold), SUM(s.amount_sold), p.prod_name, t.calendar_month_name, COUNT(*), COUNT(s.quantity_sold), COUNT(s.amount_sold) FROM sales s, products p, times t WHERE s.time_id = t.time_id AND s.prod_id = p.prod_id GROUP BY t.calendar_month_name, p.prod_id, p.prod_name, s.time_id;
cust_mth_sales_mv includes the partition key column from table sales (time_id) in both its SELECT and GROUP BY lists. This enables PCT on table sales for materialized view cust_mth_sales_mv. However, the GROUP BY and SELECT lists include PRODUCTS.PROD_ID rather than the partition key column (PROD_CATEGORY) of the products table. Therefore, PCT is not enabled on table products for this materialized view. In other words, any partition maintenance operation to the sales table will allow a PCT fast refresh of cust_mth_sales_mv. However, PCT fast refresh is not possible after any kind of modification to the products table. To correct this, the GROUP BY and SELECT lists must include column PRODUCTS.PROD_CATEGORY.
Following a partition maintenance operation, such as a drop partition, a
PCT fast refresh should be performed on any materialized view that is
referencing the table upon which the partition operations are
undertaken.CREATE MATERIALIZED VIEW prod_yr_sales_mv BUILD DEFERRED REFRESH FAST ON DEMAND ENABLE QUERY REWRITE AS SELECT DBMS_MVIEW.PMARKER(s.rowid), DBMS_MVIEW.PMARKER(p.rowid), s.prod_id, SUM(s.amount_sold), SUM(s.quantity_sold), p.prod_name, t.calendar_year, COUNT(*), COUNT(s.amount_sold), COUNT(s.quantity_sold) FROM sales s, products p, times t WHERE s.time_id = t.time_id AND s.prod_id = p.prod_id GROUP BY DBMS_MVIEW.PMARKER (s.rowid), DBMS_MVIEW.PMARKER (p.rowid), t.calendar_year, s.prod_id, p.prod_name;
prod_yr_sales_mv includes the DBMS_MVIEW.PMARKER function on the sales and products tables in both its SELECT and GROUP BY lists. This enables partition change tracking on both the sales table and the products
table with significantly less cardinality impact than grouping by the
respective partition key columns. In this example, the desired level of
aggregation for the prod_yr_sales_mv is to group by times.calendar_year. Using the DBMS_MVIEW.PMARKER function, the materialized view cardinality is increased only by a factor of the number of partitions in the sales table times, the number of partitions in the products
table. This would generally be significantly less than the cardinality
impact of including the respective partition key columns.INSERT statement adds a new row to the sales_part3 partition of table sales. At this point, because cust_mth_sales_mv and prod_yr_sales_mv have partition change tracking available on table sales, Oracle can determine that those rows in these materialized views corresponding to sales_part3 are stale, while all other rows in these materialized views are unchanged in their freshness state. An INSERT INTO products statement is not tracked for materialized view cust_mth_sales_mv. Therefore, cust_mth_sales_mv becomes completely stale when the products table is modified in this way.part_sales_mv, which uses three partitions, can be fast refreshed, and is eligible for query rewrite.CREATE MATERIALIZED VIEW part_sales_mv PARALLEL PARTITION BY RANGE (time_id) (PARTITION month1 VALUES LESS THAN (TO_DATE('31-12-1998', 'DD-MM-YYYY')) PCTFREE 0 PCTUSED 99 STORAGE (INITIAL 64k NEXT 16k PCTINCREASE 0) TABLESPACE sf1, PARTITION month2 VALUES LESS THAN (TO_DATE('31-12-1999', 'DD-MM-YYYY')) PCTFREE 0 PCTUSED 99 STORAGE (INITIAL 64k NEXT 16k PCTINCREASE 0) TABLESPACE sf2, PARTITION month3 VALUES LESS THAN (TO_DATE('31-12-2000', 'DD-MM-YYYY')) PCTFREE 0 PCTUSED 99 STORAGE (INITIAL 64k NEXT 16k PCTINCREASE 0) TABLESPACE sf3) BUILD DEFERRED REFRESH FAST ENABLE QUERY REWRITE AS SELECT s.cust_id, s.time_id, SUM(s.amount_sold) AS sum_dol_sales, SUM(s.quantity_sold) AS sum_unit_sales FROM sales s GROUP BY s.time_id, s.cust_id;
CREATE TABLE part_sales_tab(time_id, cust_id, sum_dollar_sales, sum_unit_sale) PARALLEL PARTITION BY RANGE (time_id) ( PARTITION month1 VALUES LESS THAN (TO_DATE('31-12-1998', 'DD-MM-YYYY')) PCTFREE 0 PCTUSED 99 STORAGE (INITITAL 64k NEXT 16k PCTINCREASE 0) TABLESPACE sf1, PARTITION month2 VALUES LESS THAN (TO_DATE('31-12-1999', 'DD-MM-YYYY')) PCTFREE 0 PCTUSED 99 STORAGE (INITIAL 64k NEXT 16k PCTINCREASE 0) TABLESPACE sf2, PARTITION month3 VALUES LESS THAN (TO_DATE('31-12-2000', 'DD-MM-YYYY')) PCTFREE 0 PCTUSED 99 STORAGE (INITIAL 64k NEXT 16k PCTINCREASE 0) TABLESPACE sf3) AS SELECT s.time_key, s.cust_id, SUM(s.amount_sold) AS sum_dollar_sales, SUM(s.quantity_sold) AS sum_unit_sales FROM sales s GROUP BY s.time_id, s.cust_id; CREATE MATERIALIZED VIEW part_sales_tab_mv ON PREBUILT TABLE ENABLE QUERY REWRITE AS SELECT s.time_id, s.cust_id, SUM(s.amount_sold) AS sum_dollar_sales, SUM(s.quantity_sold) AS sum_unit_sales FROM sales s GROUP BY s.time_id, s.cust_id;
part_sales_tab has
been partitioned over three months and then the materialized view was
registered to use the prebuilt table. This materialized view is eligible
for query rewrite because the ENABLE QUERY REWRITE clause has been included.| See Also:
Chapter 14, "Maintaining the Data Warehouse" for further details regarding
CONSIDER FRESH and "Storage And Data Segment Compression" for details regarding compression |
| ROLLUP By Time | ROLLUP By Product |
|---|---|
|
year, quarter, month
|
division, brand, item
|
|
year, quarter
|
division, brand
|
|
year
|
division
|
|
all times
|
all products
|
GROUP BY clause introduced in Oracle9i.GROUP BY
clause, concatenated grouping sets, to generate the aggregates needed
for a hierarchical cube of data. By using concatenated rollup (rolling
up along the hierarchy of each dimension and then concatenate them
across multiple dimensions), you can generate all the aggregations
needed by a hierarchical cube. These extensions are discussed in detail
in Chapter 18, "SQL for Aggregation in Data Warehouses".GROUP BY
clause needed to create a hierarchical cube for the 2-dimension example
described earlier. The following simple syntax performs a concatenated
rollup:GROUP BY ROLLUP(year, quarter, month), ROLLUP(Division, brand, item);
ROLLUP
aggregations listed in the table of the prior section and perform a
cross-product on them. The cross-product will create the 16 (4x4)
aggregate groups needed for a hierarchical cube of the data.SELECT month, division, sum_sales FROM (SELECT year, quarter, month, division, brand, item, SUM(sales) sum_sales, GROUPING_ID(grouping-columns) gid FROM sales, products, time WHERE join-condition GROUP BY ROLLUP(year, quarter, month), ROLLUP(division, brand, item) ) WHERE division = 25 AND month = 200201 AND gid = gid-for-Division-Month;
GROUPING_ID function in the query identifies the specific group each row belongs to, based on the aggregation level of the grouping-columns in its argument.GID column, indicated in the query by gid-for-division-month would be the value of a key indicating that the data is grouped as a combination of division and month. The GID constraint selects only those rows that are aggregated at the level of a GROUP BY month, division clause.division and month. Any other groups involving year, month, brand, and item are unnecessary here. The group pruning optimization recognizes this and transforms the query into:SELECT month, division, sum_sales FROM (SELECT null, null, month, division, null, null, SUM(sales) sum_sales, GROUPING_ID(grouping-columns) gid FROM sales, products, time WHERE join-condition GROUP BY month, division) WHERE division = 25 AND month = 200201 AND gid = gid-for-Division-Month;
GROUP BY clause of month, division. The columns year, quarter, brand and item have been converted to null to match the simplified GROUP BY
clause. Because the query now requests just one group, fifteen out of
sixteen groups are removed from the processing, greatly reducing the
work. For a cube with more dimensions and more levels, the savings
possible through group pruning can be far greater. Note that the group
pruning transformation works with all the GROUP BY extensions: ROLLUP, CUBE, and GROUPING SETS.GROUP BY,
faster response times can be achieved if the group is precomputed and
stored in a materialized view. Because OLAP queries can ask for any
slice of the cube many groups may need to be precomputed and stored in a
materialized view. This is discussed in the next section.| See Also:
Oracle9i SQL Reference for data compression syntax and restrictions and "Storage And Data Segment Compression" for details regarding compression
|
CREATE MATERIALIZED VIEW sales_hierarchical_cube_mv REFRESH FAST ON DEMAND ENABLE QUERY REWRITE AS SELECT country_id, cust_state_province, cust_city, prod_category, prod_subcategory, prod_name, calendar_month_number, day_number_in_month, day_number_in_week, GROUPING_ID(country_id, cust_state_province, cust_city, prod_category, prod_subcategory, prod_name, calendar_month_number, day_number_in_month, day_number_in_week) gid, SUM(amount_sold) s_sales, COUNT(amount_sold) c_sales, COUNT(*) c_star FROM sales s, products p, customers c, times t WHERE s.cust_id = c.cust_id AND s.prod_id = p.prod_id AND s.time_id = t.time_id GROUP BY ROLLUP(country_id, (cust_state_province, cust_city)), ROLLUP(prod_category, (prod_subcategory, prod_name)), ROLLUP(calendar_month_number, (day_number_in_month, day_number_in_week)) PARTITION BY LIST (gid) ...;
CREATE MATERIALIZED VIEW sales_mv REFRESH FAST ON DEMAND ENABLE QUERY REWRITE AS SELECT country_id, cust_state_province, cust_city, prod_category, prod_subcategory, prod_name, GROUPING_ID(country_id, cust_state_province, cust_city, prod_category, prod_subcategory, prod_name) gid, SUM(amount_sold) s_sales, COUNT(amount_sold) c_sales, COUNT(*) c_star FROM sales s, products p, customers c WHERE s.cust_id = c.cust_id and s.prod_id = p.prod_id GROUP BY GROUPING SETS ((country_id, cust_state_province, cust_city), (country_id, prod_category, prod_subcategory, prod_name), (prod_category, prod_subcategory, prod_name),(country_id, prod_category)) PARTITION BY LIST (gid) ...;
GROUPING SETS extension to GROUP BY.GROUPING_ID column.
By partitioning the materialized views this way, you enable partition
pruning for queries rewritten against this materialized view: only
relevant aggregate groups will be accessed, greatly reducing the query
processing cost.ROLLUP clause are likely candidates.| See Also:
Oracle9i SQL Reference for data compression syntax and restrictions and "Storage And Data Segment Compression" for details regarding compression
|
ON COMMIT or ON DEMAND refresh.UNION ALL operator at the top level and each query block in the UNION ALL,
meets the requirements of a materialized view with aggregates or
materialized view with joins only. Further, the materialized view must
include a constant column (known as a UNION ALL marker) that has a distinct value in each query block, which, in the following example, is columns 1 marker and 2 marker.UNION ALL.UNION ALL.UNION ALL
materialized view with two join views, the materialized view logs must
have the rowid column and, in the following example, the UNION ALL marker is the columns, 1 marker and 2 marker.CREATE MATERIALIZED VIEW LOG ON sales WITH ROWID; CREATE MATERIALIZED VIEW LOG ON customers WITH ROWID; CREATE MATERIALIZED VIEW unionall_sales_cust_joins_mv BUILD DEFERRED REFRESH FAST ON COMMIT ENABLE QUERY REWRITE AS (SELECT c.rowid crid, s.rowid srid, c.cust_id, s.amount_sold, 1 marker FROM sales s, customers c WHERE s.cust_id = c.cust_id AND c.cust_last_name = 'Smith') UNION ALL (SELECT c.rowid crid, s.rowid srid, c.cust_id, s.amount_sold, 2 marker FROM sales s, customers c WHERE s.cust_id = c.cust_id AND c.cust_last_name = 'Brown');
UNION ALL
of a materialized view with joins and a materialized view with
aggregates. A couple of things can be noted in this example. Nulls or
constants can be used to ensure that the data types of the corresponding
SELECT list columns match. Also the UNION ALL marker column can be a string literal, which is 'Year' umarker, 'Quarter' umarker, or 'Daily' umarker in the following example:DROP MATERIALIZED VIEW LOG ON sales; CREATE MATERIALIZED VIEW LOG ON sales WITH ROWID, SEQUENCE (amount_sold, time_id) INCLUDING NEW VALUES; DROP MATERIALIZED VIEW LOG ON times; CREATE MATERIALIZED VIEW LOG ON times WITH ROWID, SEQUENCE (time_id, fiscal_year, fiscal_quarter_number, day_number_in_week) INCLUDING NEW VALUES; DROP MATERIALIZED VIEW unionall_sales_mix_mv; CREATE MATERIALIZED VIEW unionall_sales_mix_mv BUILD DEFERRED REFRESH FAST ON DEMAND AS (SELECT 'Year' umarker, NULL, NULL, t.fiscal_year, SUM(s.amount_sold) amt, COUNT(s.amount_sold), COUNT(*) FROM sales s, times t WHERE s.time_id = t.time_id GROUP BY t.fiscal_year) UNION ALL (SELECT 'Quarter' umarker, NULL, NULL, t.fiscal_quarter_number, SUM(s.amount_sold) amt, COUNT(s.amount_sold), COUNT(*) FROM sales s, times t WHERE s.time_id = t.time_id and t.fiscal_year = 2001 GROUP BY t.fiscal_quarter_number) UNION ALL (SELECT 'Daily' umarker, s.rowid rid, t.rowid rid2, t.day_number_in_week, s.amount_sold amt, 1, 1 FROM sales s, times t WHERE s.time_id = t.time_id and t.time_id between '01-Jan-01' and '01-Dec-31');
USING NO INDEX is specified in the CREATE MATERIALIZED VIEW statement.| See Also:
Chapter 21, "Using Parallel Execution" for further details
|
INSERT, or DELETE, UPDATE, or
DDL operation on any dependency in the materialized view will cause it
to become invalid. To revalidate a materialized view, use the ALTER MATERIALIZED VIEW COMPILE statement.ALTER MATERIALIZED VIEW mview_name ENABLE QUERY REWRITE;
USER_MVIEWS or ALL_MVIEWS. The column STALENESS will show one of the values FRESH, STALE, UNUSABLE, UNKNOWN, or UNDEFINED
to indicate whether the materialized view can be used. The state is
maintained automatically, but it can be manually updated by issuing an ALTER MATERIALIZED VIEW name COMPILE statement.CREATE MATERIALIZED VIEW privilege and the SELECT
privilege to any tables referenced that are in another schema. To
create a materialized view in another schema, you must have the CREATE ANY MATERIALIZED VIEW privilege and the owner of the materialized view needs SELECT privileges to the tables referenced if they are from another schema.GLOBAL QUERY REWRITE privilege or the QUERY REWRITE object privilege on each table outside your schema.SELECT WITH GRANT privilege on the container table.SELECT access to the referenced tables if the tables are in a different schema.ON COMMIT REFRESH
specified, then the owner of the materialized view requires an
additional privilege if any of the tables in the defining query are
outside the owner's schema. In that case, the owner requires the ON COMMIT REFRESH system privilege or the ON COMMIT REFRESH object privilege on each table outside the owner's schema.FAST/FORCE/COMPLETE/NEVER)ON COMMIT/ON DEMAND)COMPILE clause of the ALTER MATERIALIZED VIEW
statement can be used when the materialized view has been invalidated.
This compile process is quick, and allows the materialized view to be
used by query rewrite again.| See Also:
Oracle9i SQL Reference for further information about the
ALTER MATERIALIZED VIEW statement and "Invalidating Materialized Views" |
DROP MATERIALIZED VIEW statement to drop a materialized view. For example:DROP MATERIALIZED VIEW sales_sum_mv;
sales_sum_mv.
If the materialized view was prebuilt on a table, then the table is not
dropped, but it can no longer be maintained with the refresh mechanism
or used by query rewrite. Alternatively, you can drop a materialized
view using Oracle Enterprise Manager.DBMS_MVIEW.EXPLAIN_MVIEW
procedure to learn what is possible with a materialized view or
potential materialized view. In particular, this procedure enables you
to determine:DBMS_MVIEW.EXPLAIN_MVIEW,
passing in as a single parameter the schema and materialized view name
for an existing materialized view. Alternatively, you can specify the SELECT
string for a potential materialized view. The materialized view or
potential materialized view is then analyzed and the results are written
into either a table called MV_CAPABILITIES_TABLE, which is the default, or to an array called MSG_ARRAY.utlxmv.sql script prior to calling EXPLAIN_MVIEW except when you are placing the results in MSG_ARRAY. The script is found in the admin directory. In addition, you must create MV_CAPABILITIES_TABLE in the current schema. An explanation of the various capabilities is in Table 8-6, and all the possible messages are listed in Table 8-7.DBMS_MVIEW.EXPLAIN_MVIEW procedure has the following parameters:stmt_id
EXPLAIN_MVIEW.mv
msg-array
DBMS_MVIEW.EXPLAIN_MVIEW analyzes the
specified materialized view in terms of its refresh and rewrite
capabilities and inserts its results (in the form of multiple rows) into
MV_CAPABILITIES_TABLE or MSG_ARRAY.| See Also:
Oracle9i Supplied PL/SQL Packages and Types Reference for further information about the
DBMS_MVIEW package |
DBMS_MVIEW
package show the order and datatypes of these parameters for explaining
an existing materialized view and a potential materialized view with
output to a table and to a VARRAY.MV_CAPABILITIES_TABLE:DBMS_MVIEW.EXPLAIN_MVIEW (mv IN VARCHAR2, stmt_id IN VARCHAR2:= NULL);
VARRAY:DBMS_MVIEW.EXPLAIN_MVIEW (mv IN VARCHAR2, msg_array OUT SYS.ExplainMVArrayType);
DBMS_MVIEW.EXPLAIN_MVIEW is with the MV_CAPABILITIES_TABLE, which has the following structure:CREATE TABLE MV_CAPABILITIES_TABLE ( STMT_ID VARCHAR(30), -- client-supplied unique statement identifier MV VARCHAR(30), -- NULL for SELECT based EXPLAIN_MVIEW CAPABILITY_NAME VARCHAR(30), -- A descriptive name of particular -- capabilities, such as REWRITE. -- See Table 8-6 POSSIBLE CHARACTER(1), -- Y = capability is possible -- N = capability is not possible RELATED_TEXT VARCHAR(2000), -- owner.table.column, and so on related to -- this message RELATED_NUM NUMBER, -- When there is a numeric value -- associated with a row, it goes here. MSGNO INTEGER, -- When available, message # explaining -- why disabled or more details when -- enabled. MSGTXT VARCHAR(2000), -- Text associated with MSGNO SEQ NUMBER); -- Useful in ORDER BY clause when -- selecting from this table.
utlxmv.sql script found in the admin directory to create MV_CAPABILITIES_TABLE.EXPLAIN_MVIEW on a potential materialized view using its SELECT statement.CREATE MATERIALIZED VIEW cal_month_sales_mv BUILD IMMEDIATE REFRESH FORCE ENABLE QUERY REWRITE AS SELECT t.calendar_month_desc, SUM(s.amount_sold) AS dollars FROM sales s, times t WHERE s.time_id = t.time_id GROUP BY t.calendar_month_desc;
EXPLAIN_MVIEW with the materialized view to explain. You need to use the SEQ column in an ORDER BY clause so the rows will display in a logical order. If a capability is not possible, N will appear in the P column and an explanation in the MSGTXT column. If a capability is not possible for more than one reason, a row is displayed for each reason.EXECUTE DBMS_MVIEW.EXPLAIN_MVIEW ('SH.CAL_MONTH_SALES_MV'); SELECT capability_name, possible, SUBSTR(related_text,1,8) AS rel_text, SUBSTR(msgtxt,1,60) AS msgtxt FROM MV_CAPABILITIES_TABLE ORDER BY seq;
CAPABILITY_NAME P REL_TEXT MSGTXT --------------- - -------- ------ PCT N REFRESH_COMPLETE Y REFRESH_FAST N REWRITE Y PCT_TABLE N SALES no partition key or PMARKER in select list PCT_TABLE N TIMES relation is not a partitioned table REFRESH_FAST_AFTER_INSERT N SH.TIMES mv log must have new values REFRESH_FAST_AFTER_INSERT N SH.TIMES mv log must have ROWID REFRESH_FAST_AFTER_INSERT N SH.TIMES mv log does not have all necessary columns REFRESH_FAST_AFTER_INSERT N SH.SALES mv log must have new values REFRESH_FAST_AFTER_INSERT N SH.SALES mv log must have ROWID REFRESH_FAST_AFTER_INSERT N SH.SALES mv log does not have all necessary columns REFRESH_FAST_AFTER_ONETAB_DML N DOLLARS SUM(expr) without COUNT(expr) REFRESH_FAST_AFTER_ONETAB_DML N see the reason why REFRESH_FAST_AFTER_INSERT is disabled REFRESH_FAST_AFTER_ONETAB_DML N COUNT(*) is not present in the select list REFRESH_FAST_AFTER_ONETAB_DML N SUM(expr) without COUNT(expr) REFRESH_FAST_AFTER_ANY_DML N see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled REFRESH_FAST_AFTER_ANY_DML N SH.TIMES mv log must have sequence REFRESH_FAST_AFTER_ANY_DML N SH.SALES mv log must have sequence REFRESH_PCT N PCT is not possible on any of the detail tables in the materialized view REWRITE_FULL_TEXT_MATCH Y REWRITE_PARTIAL_TEXT_MATCH Y REWRITE_GENERAL Y REWRITE_PCT N PCT is not possible on any detail tables
| See Also:
Chapter 14, "Maintaining the Data Warehouse" and Chapter 22, "Query Rewrite" for further details about PCT
|
CAPABILITY_NAME column.
0 Comments