Materialized Views; Types Of Materialized Views - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

Materialized Views

A materialized view (MV) is a view that is materialized by storing its tuples as a regular table.
As a table, a materialized view can be queried directly, indexes can be created for performance,
partitioning can promote scalability, and so on. A materialized view provides fast access to data.
This is especially important in applications where the query rate is high and the MVs are complex,
for example, in aggregate queries over large volumes of data. Materialized views can provide a
framework within which to collect information into a data warehouse from several databases.
Queries on the warehouse can then use the materialized views without accessing the base
databases.
As base tables change, the MV needs to be updated also. Ideally, the MV should be incrementally
refreshed and not recomputed. That is, changes to the MV are computed based on the changes
to the base table and then the MV is updated. When the MV is very large and the incremental
changes are relatively small, it is very reasonable to apply the incremental changes. In cases
where incremental MV refresh time is significantly shorter than the time required to recompute
the MV, the advantage of the materialized view is clear.
One of the most common uses of materialized views are summary tables (Materialized Aggregate
Views). Data warehouses store large volumes of transaction history (fact tables) which are almost
always queried using "dimension" grouping. For example, in a retail database, the sales
transaction history can be queried by region, by item-category and by month, or by year and
store-id. Answering these queries from the sales data in a reasonable time is almost impossible.
To overcome the performance problem the user can define summary tables on the fact table, and
use these summary tables to answer the queries. Since summary tables are usually much smaller
than the original tables, the queries are executed much faster.

Types of Materialized Views

Neoview SQL defines the following three types of materialized views:
Materialized Join View (MJV): An ON STATEMENT or ON REQUEST materialized view
holds the results of a join query with inner equi-joins of several tables. Outer joins and cross
joins are not supported. These tables can be base tables or other MVs. The query does not
include aggregations. A materialized view on a single table without an aggregate is also an
MJV.
Materialized Aggregate View (MAV): An ON REQUEST materialized view holds the result
of a GROUP BY query with any of these aggregate functions: SUM, AVG, VARIANCE,
STDDEV, MIN, MAX, COUNT(*), and COUNT(x). The aggregate function can include
expression on the columns, such as SUM(a+b). Aggregate MVs can be of two types:
— MAV on Single Table: the MAV is defined on a single base table or MV.
— MAV on Explicit Join (MAJV): the MAV is defined on an inner equi-join of several base
tables, MVs, or both.
RECOMPUTE materialized views: A materialized view that is initialized every time the
materialized view needs to be updated with changes to its base tables. RECOMPUTE
materialized views can hold the result of any query that can be specified for a regular view.
For more information about materialized views, see the
Statement" (page
63).
"CREATE MATERIALIZED VIEW
Materialized Views
281

Advertisement

Table of Contents
loading

Table of Contents