Database Reference
In-Depth Information
we denote V M
=
V 1
V 2 as the merging of V 1 and V 2 when the following
properties hold:
1. C 1 (
V M )
V 1 and C 2 (
V M )
V 2 for some SQL fragments C 1 (
V M )
and
.
2. If the view-matching algorithm matches V 1 or V 2 for a subquery q ,it
also matches V M for q (a view-matching algorithm matches a view V
for a subquery q if q can be answered from V ).
3. V M cannot be further restricted with additional predicates and continue
to satisfy the previous properties.
C 2 (
V M )
8.2.2.1
Case 1: No Grouping Columns
Consider merging V 1 = (
S 1 ,
T
,
J 1 ,
R 1 ,
Z 1 , ) and V 2 = (
S 2 ,
T
,
J 2 ,
R 2 ,
Z 2 , ) .If
the merging language were expressive enough, we could define V 1
V 2 as
SELECT S 1
S 2
FROM T
WHERE ( J 1 AND R 1 AND Z 1 )OR( J 2 AND R 2 AND Z 2 )
which satisfies properties 1 and 3. Since V 1
V 2 has to be defined in terms
of the view definition language, we have no option but to consider the whole
predicate in the WHERE clause as a single conjunctive residual predicate Z . The
problem is that now the merged view would not be matched whenever V 1 or
V 2 are matched (property 2) because of the simple procedures used during
view matching with respect to residual predicates. Instead, we rewrite the
“minimal” predicate as follows:
(
J 1
R 1
Z 1 ) (
J 2
R 2
Z 2 ) (
J 1
J 2 ) (
R 1
R 2 ) (
Z 1
Z 2 )
C
where C is the conjunction of all crossed disjuncts (
(
J 1
R 2 ) (
R 1
Z 2 )
...
). The idea is to relax this expression until we obtain a predicate that
can be written in the view definition language and matches any candidate
query that is matched by the original views. Although this procedure seems
to introduce a lot of redundancy and to result in larger views, in real-world
scenarios this is not usually the case.
We first relax the previous expression by removing the conjunct C . The
reason is that it leaves us with three conjuncts ( J 1
Z 2 ),
which we next map into the three groups of predicates in the view definition
language. First, consider J 1
J 2 , R 1
R 2 , and Z 1
J 2 and recall that each J i is a conjunct of equi-
join predicates. We cannot simply use J 1
J 2 in the resulting view because
the language specifies that this must be a conjunction of simple equi-joins
(i.e., no disjunctions are allowed). We rewrite
i , j (
J 2 )
J 1
J 1
J 1
J 2
J 2
J 2
J 1
J 1
J 2 (
...) (
...)
Search WWH ::




Custom Search