



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Hyp ergraphs
Hypergraph = no des plus (hyp er)edges that are sets of any numb er of no des.
Applications include optimizing queries that are joins and representing \universal relations" (a useful data-mo deling concept).
Typically, no des represent attributes and hyp eredges are sets of attributes.
Example
Supp ose we have relations with schemas AB C , AC D , and B E. This database schema could b e represented by the hyp ergraph
A B
C
E
D
Acyclic Hyp ergraphs
These have some useful prop erties that make query optimization easier than the general case. Most \natural" queries corresp ond to acyclic hyp ergraphs.
De nition dep ends on GYO reduction; GYO = Graham-Yu-Ozsoyoglu.
An ear is a hyp eredge H such that we can divide its no des into two groups: those that app ear in H and no other hyp eredge and those that are contained in another hyp eredge G. F Note that an isolated edge is an ear; no G is needed.
GYO reduction of a hyp ergraph is the pro cess of rep eatedly nding ears and removing them. That is, we remove those no des that are in the ear and no other hyp eredge; then we remove the hyp eredge itself, leaving the other no des.
F We say that ear H is consumed by G, if all the no des that are not unique to H are in G. F If a hyp ergraph is reduced to nothing
1
by GYO reduction, then it is said to b e acyclic.
F Aside: \acyclic" makes sense: if the hyp ergraph is an ordinary graph, it is acyclic i it is a tree.
Example
Here is an acyclic hyp ergraph
A
B C
E
F
D
The central hyp eredge D E F can consume each of the other three hyp eredges.
At that time, the remaining hyp eredge is trivially an ear, since all of its no des are unique to it.
Formal GYO Reduction
The original de nition of GYO reduction consisted of the following two steps:
The goal is to reduce a hyp ergraph to a single, empty hyp eredge.
You need to lo ok at GYO reduction this way to show that there is a unique GYO reduction of any hyp ergraph, acyclic or not. F Key idea of pro of: candidates for step (1) remain candidates, no matter what other steps are taken.
Dangling Tuple Elimination
Useful as a rst step in optimizing large joins.
Example
Consider AB = f 00 ; 11 g, B C = f 00 ; 11 g, and AC = f 01 ; 10 g.
Any two relations are join-consistent. E.g., AB ./ AC = f 001 ; 110 g, which pro jected onto AB is f 00 ; 11 g.
But AB ./ B C ./ AC = ;, so the relations are not globally consistent.
Reduction by Semijoins
If we are to take the join of several relations, it is often ecient to rst remove the dangling tuples.
It guarantees that whatever order we join in, the result never shrinks. Thus, the total work is prop ortional to the output, and we can't do more than a constant factor b etter than that.
To reduce relations to globally consistent subsets, we can use the semijoin op eration: R := R ><^ S = R (R ./ S ) = R ./
Sometimes, semijoins don't help eliminating dangling tuples. F For example, AB , B C , and AC ab ove are not changed by any semijoin.
However, if the hyp ergraph is acyclic, the following algorithm pro duces a ful l reducer for a set of relations. F That is, the result is a set of globally join- consistent relations.
Example
Consider the relation schemas AB C , AC D , and D E.
AC D is an ear that is consumed by AB C.
In the resulting hyp ergraph, AB C can b e consumed by B E.
The full reducer:
AB C := AB C ><^ AC D B E := B E ><^ AB C AB C := AB C ><^ B E AC D := AC D ><^ AB C
Pro of It Works
After step (1), it is imp ossible for the join of the remaining hyp eredges to have a tuple that do esn't join with any tuple of E.
Inductively, step (2) leaves the relations other than E in a globally join-consistent state.
Then, step (3) eliminates from E any tuples that do not join with the other relations.