Database Reference
In-Depth Information
must check if the product is in the food category (except if c3 is already in
the view, in which case nothing should be done).
We say an attribute is distinguished in a view V if it appears in the
SELECT clause of the view definition. An attribute A belonging to a relation
R is exposed in a view V if A is used in a predicate in V . We briefly present
some well-known results in view maintenance theory:
￿ A select-project-join view is not self-maintainable with respect to inser-
tions.
￿ A select-project-join view is self-maintainable with respect to deletions in
a relation R if the key attributes from each occurrence of R in the join are
either included in the view or equated to a constant in the view definition.
Note that none of these conditions are satisfied in the example above.
￿ A left or full outer join view V defined using two relations R and S such
that the keys of R and S are distinguished and all exposed attributes
of R are distinguished is self-maintainable with respect to all types of
modifications in S .
Consider again the outer join view defined in the previous section and the
instances of Fig. 7.2 :
CREATE VIEW ProductShipper AS (
SELECT P.ProdID, P.ProdName, S.ShipID, S.ShipName
FROM Product P FULL OUTER JOIN Shipper S ON
P.ShipID = S.ShipID )
Since this view satisfies the third condition above, it is self-maintainable
with respect to all types of modifications in Product . Let us first compute
the projection of the view over Shipper , expressed as Proj Shipper =
π ShipID , ShipName ( Product
Shipper ), shown in Fig. 7.3 a. Notice that the tuple
( NULL , NULL ) is excluded from this projection. The tables Δ + ( Product )and
Δ ( Product ) denoting, respectively, the tuples inserted and deleted from
Product are shown in Fig. 7.3 b,c. Since the view is self-maintainable, we can
join these delta tables with Proj Shipper instead of Shipper , thus avoiding to
access the base relations. The joins between delta tables and Proj Shipper
are shown in Fig. 7.3 d,e. Finally, the result of both joins is merged with the
original view and the side effects are addressed. For example, when inserting
( p3 , MP3 , s2 , DHL ) , we must delete ( NULL , NULL , s2 , DHL ) . Analogously,
when deleting ( p1 , TV , s1 , Fedex ) , we must insert ( NULL , NULL , s1 , Fedex ) .
Figure 7.3 f shows the final result.
7.3 Data Cube Maintenance
In data warehouses, materialized views that include aggregate functions
are called summary tables . We now discuss how summary tables can be
maintained with minimum access to the base data while keeping maximum
 
Search WWH ::




Custom Search