BCNF and Lossless Join Algorithms




CS157a

Chris Pollett

Sep 25, 2023

Outline

Introduction

Decomposition into BCNF

Example

Algorithm for BCNF Decomposition

In the below, we slightly abuse notation by identifying in places a relation with its set of attributes.

Input. A relation `R_0` with a set of FDs `S_0`.

Output. A decomposition of `R_0` into a collection of relations, all of which are in BCNF.

Method. The following steps are applied recursively to any relation `R` and set of FDs `S`. Initially, set `R = R_0`, `S= S_0`.

  1. Check whether `R` is in BCNF. If so, nothing more needs to be done. Return `{R}` as the answer.
  2. If there are BCNF violations, let one be `X -> Y` . Compute `X^+` using our algorithm from last Monday. Choose `R_1 = X^+` as one relation schema and let `R_2` have attributes `X` and those attributes of `R` that are not in `X^+`. I.e., `R_2` has attributes `(X \cup (R-X^+))`.
  3. Use the algorithm from last Wednesday to compute the sets of FD's for `R_1` and `R_2` ; let these be `S_1` and `S_2`, respectively.
  4. Recursively decompose `R_1` and `R_2` using this algorithm. Return the union of the results of these decompositions.

Quiz

Which of the following is true?

  1. After applying the splitting rule to a FD, the resulting set of FDs is equivalent to the original FD.
  2. If the only FDs that apply to the attributes in `X = {A_1, ..., A_n}` are trivial then `X^{\+}` will be the empty set.
  3. We used our algorithm for projecting FDs onto a sub-table in our algorithm to find a minimal basis for a set of FDs.

More on "Good" Relation Schemas

The Importance of Joins

Chase Test for Lossless Join - Making a Tableaux

Chase Test for Lossless Join - Performing a Chase