Database Reference
In-Depth Information
The above examples show the need of characterizing the kinds of view
maintenance problems in terms of the kind of update and of the operations
in the view definition. Two main classes of algorithms for view maintenance
have been studied in the database literature:
￿ Algorithms using full information, which means the views and the base
relations.
￿ Algorithms using partial information, namely, the materialized views and
the key constraints.
7.2.1 Algorithms Using Full Information
Three kinds of views are addressed by these algorithms: nonrecursive views,
outer-join views, and recursive views. In this section, we discuss the first two
kinds and omit the discussion on recursive views, which is beyond the scope
of this topic.
The basic algorithm for nonrecursive views (which may include join, union,
negation, and aggregation) is the counting algorithm . This algorithm
counts the number of alternative derivations that every tuple in the view
has. In this way, if we delete a tuple in a base relation, we can check whether
or not we should delete it from the view. To study this kind of view, let us
consider the relation FoodCustomers introduced above. The view is created
as follows:
CREATE VIEW FoodCustomers AS (
SELECT DISTINCT CustomerKey
FROM Sales S, Product P
WHERE S.ProductKey = P.ProductKey AND P.CategoryName = ' Food ' )
An instance of relation Sales is depicted in Fig. 7.1 a; the view FoodCustomers
over this instance is shown in Fig. 7.1 b. We added a column Count indicating
the number of possible derivations for each tuple. For example, ( c2 , 2 )means
that customer c2 bought two products from the category food. Further, we
a
b
c
ProductKey CustomerKey Quantity
p1
CustomerKey Count
c1
CustomerKey Count
c1
c1
20
1
1
p1
c2
100
c2
2
c2
1
p2
c2
50
···
···
···
Fig. 7.1 An example of the counting algorithm. ( a ) Instance of the Sales relation.
( b )View FoodCustomers , including the number of possible derivations of each tuple.
( c )View FoodCustomers after the deletion of ( p1 , c2 , 100 )
 
Search WWH ::




Custom Search