Canonical Cover
Canonical Cover :
Canonical cover or minimal cover is the way of reducing the functional dependencies without changing the meaning of it. Why we go for canonical cover is because it takes time when all functional dependencies are applied on DBMS.
Let us work with an example to make it clear :
A->BC
AB->C
A->C
There are 3 steps involved in converting to canonical cover
Step 1 :
All the FD's should be in the form X->a where "X" is a set of attribute or a single attribute and "a" must be single attribute.
So for the above example it reduces as follows
A->B
A->C
AB->C
A->C (write it as such this will be dealt in step 3)
Step 2:
Remove redundant attributes that is try to remove X if it has more than one attribute.
So for the above example
AB-> C
To reduce this what we must do is we must answer the question if A->C or B->C if it does then write
the correct one.
In the above example A->C so it reduces as A->C
So the FD's now are
A->B
A->C
A->C
A->C
Step 3:
Remove the FD's which have the same meaning.
So it reduces as
A->B
A->C
This FD is sufficient to represent it in DBMS. The last set of FD's obtained are called Canonical Cover.
Advantage of Canonical Cover :
A->BC
AB->C
A->C
Instead of applying above three rules we just apply the following rules
A->B
A->C
This is a small example. Imagine a big case where we can reduce more number of FD's which improves execution time of query.
This is a small example. Imagine a big case where we can reduce more number of FD's which improves execution time of query.
Comments
Post a Comment