Considerations For Create Materialized View; Types Of Materialized Views; Authorization - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

Hash partitioning is the only partitioning scheme supported for materialized views. This
clause defines the partitioning keys of the materialized view.
non-aggregate-column-expr
col-expr is a single column name or a derived column. A derived column (derived-name)
is an SQL value expression; its operands can be numeric, string, datetime, or interval literals,
columns, functions defined on columns, scalar subqueries, CASE expressions, or CAST
expressions. Any single column name in col-expr must be from tables or views specified
in the FROM clause.
aggregate-name
Specifies the aggregate name: AVG, COUNT, MAX, MIN, STDDEV, SUM, or VARIANCE.
query-expr
is a subset of the query expression supported in a regular view definition. Only expressions
that start with SELECT are supported.
mv-attributes
The COMMIT REFRESH EACH attribute is only allowed for ON REQUEST MVs that are
defined on single delta MVs. A single delta MV is an MV that can be refreshed based on
changes to a single table. So, a MAV or a single delta MAJV (an MV that ignores updates for
all the tables in the FROM clause except one table) can specify the COMMIT REFRESH EACH.

Considerations for CREATE MATERIALIZED VIEW

Materialized aggregate views do not support the DISTINCT clause as an argument of the
aggregate function. Additionally, aggregate functions as subqueries in an aggregate function
expression are not allowed.
If optional column names for the materialized view are not specified, they default to the
column names (or derived names) specified in the materialized view query expression.
You can specify GROUP BY using ordinals to refer to the relative position within the SELECT
list. For example, GROUP BY 3, 2, 1.
Materialized views cannot be created on views.

Types of Materialized Views

Neoview SQL defines the following three types of materialized views:
Materialized Join View (MJV): A materialized join view that 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.
Materialized Aggregate View (MAV): A materialized aggregate view that 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.

Authorization

Materialized views have the same security policies as regular views, which are independent of
those of its underlying tables.
The creator of a materialized view must have SELECT privileges on all the objects underlying
the materialized view. To grant a SELECT privilege on the materialized view to another user,
the creator of the materialized view must have the grant option on the underlying objects.
62
SQL Statements

Advertisement

Table of Contents
loading

Table of Contents