Minimum Cover of F. Minimal Cover for a Set of FDs Minimal cover G for a set of FDs F: –Closure of F = closure of G. –Right hand side of each FD in G.

Slides:



Advertisements
Similar presentations
Schema Refinement: Normal Forms
Advertisements

Schema Refinement: Canonical/minimal Covers
Functional Dependencies- Examples
Manipulating Functional Dependencies Zaki Malik September 30, 2008.
Chapter 11 Functional Dependencies. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.11-2 Topics in this Chapter Basic Definitions Trivial.
1 Design Theory. 2 Minimal Sets of Dependancies A set of dependencies is minimal if: 1.Every right side is a single attribute 2.For no X  A in F and.
Temple University – CIS Dept. CIS616– Principles of Data Management V. Megalooikonomou Functional Dependencies (based on notes by Silberchatz,Korth, and.
Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science Database Applications C. Faloutsos Integrity Constraints.
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
Properties of Armstrong’s Axioms Soundness All dependencies generated by the Axioms are correct Completeness Repeatedly applying these rules can generate.
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Lecture #16: Schema Refinement & Normalization - Functional Dependencies.
CS Schema Refinement and Normal Forms Chapter 19.
CS Algorithm : Decomposition into 3NF  Obviously, the algorithm for lossless join decomp into BCNF can be used to obtain a lossless join decomp.
Normalization DB Tuning CS186 Final Review Session.
Relational Design. DatabaseDesign Process Conceptual Modeling -- ER diagrams ER schema transformed to relational schema Designer may add additional integrity.
Normalization DB Tuning CS186 Final Review Session.
Integrity Constraints
Multivalued Dependency Prepared by Tomasz Kaciak CS157A.
FDImplication: 1 Functional Dependencies (FDs) Let r(R) be a relation and let t  r, then the restriction of t to X  R, written t[X], is the projection.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
1 Normalization Chapter What it’s all about Given a relation, R, and a set of functional dependencies, F, on R. Assume that R is not in a desirable.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Cs3431 Normalization Part II. cs3431 Attribute Closure : Example Consider R (A, B, C, D, E) with FDs A  B, B  C, CD  E Does A  E hold ? (Is A  E.
1 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
1 Database Theory and Methodology. 2 The Good and the Bad So far we have not developed any measure of “goodness” to measure the quality of the design,
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
FUNCTIONAL DEPENDENCIES. Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information.
Computing & Information Sciences Kansas State University Monday, 13 Oct 2008CIS 560: Database System Concepts Lecture 18 of 42 Monday, 13 October 2008.
Chapter 7: Relational Database Design. 7.2Unite International CollegeDatabase Management Systems Chapter 7: Relational Database Design Features of Good.
Normal Forms1. 2 The Problems of Redundancy Redundancy is at the root of several problems associated with relational schemas: Wastes storage Causes problems.
CSCD34 - Data Management Systems - A. Vaisman1 Schema Refinement and Normal Forms.
Schema Refinement and Normalization. Functional Dependencies (Review) A functional dependency X  Y holds over relation schema R if, for every allowable.
Schema Refinement and Normal Forms Chapter 19 1 Database Management Systems 3ed, R.Ramakrishnan & J.Gehrke.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Functional Dependencies An example: loan-info= Observe: tuples with the same value for lno will always have the same value for amt We write: lno  amt.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
1 Lecture 6: Schema refinement: Functional dependencies
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications C. Faloutsos – A. Pavlo Lecture#16: Schema Refinement & Normalization.
Christoph F. Eick: Functional Dependencies, BCNF, and Normalization 1 Functional Dependencies, BCNF and Normalization.
Functional Dependencies And Normalization R&G Chapter 19.
Database Systems/COMP4910/Spring02/Melikyan1 Schema Refinement and Normal Forms.
1 Dept. of CIS, Temple Univ. CIS616/661 – Principles of Data Management V. Megalooikonomou Integrity Constraints (based on slides by C. Faloutsos at CMU)
1 Schema Refinement and Normal Forms Week 6. 2 The Evils of Redundancy  Redundancy is at the root of several problems associated with relational schemas:
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 15.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Lecture #16: Schema Refinement & Normalization - Functional Dependencies.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Functional Dependencies CIS 4301 Lecture Notes Lecture 8 - 2/7/2006.
MIS 3053 Database Design And Applications The University Of Tulsa Professor: Akhilesh Bajaj Normal Forms Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003.
CS 222 Database Management System Spring Lecture 4 Database Design Theory Korra Sathya Babu Department of Computer Science NIT Rourkela.
1 Schema Refinement and Normal Forms Chapter The Evils of Redundancy  Redundancy is at the root of several problems associated with relational.
CS542 1 Schema Refinement Chapter 19 (part 1) Functional Dependencies.
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
Case tool Relational Database Schema Designer Cai Xinlei Tang Ning Xu Chen Zhang Yichuan CS4221 P06.
Normalization First Normal Form (1NF) Boyce-Codd Normal Form (BCNF)
Faloutsos & Pavlo SCS /615 Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Lecture #16: Schema Refinement & Normalization.
Normalization Part II cs3431.
Chapter 19 (part 1) Functional Dependencies
Computing Closure of F We could test for whether a relation scheme is in BCNF, if we could compute the closure of F. Closure of F can be computed using.
Instructor: Mohamed Eltabakh
CSC 453 Database Systems Lecture
Presentation transcript:

Minimum Cover of F

Minimal Cover for a Set of FDs Minimal cover G for a set of FDs F: –Closure of F = closure of G. –Right hand side of each FD in G is a single attribute. –If we modify G by deleting an FD or by deleting attributes from an FD in G, the closure changes. Intuitively, every FD in G is needed, and ``as small as possible’’ in order to get the same closure as F. e.g., A  B, ABCD  E, EF  GH, ACDF  EG has the following minimal cover: –A  B, ACD  E, EF  G and EF  H M.C. implies  Lossless-Join, Dep. Pres. Decomp!!! –Start with M.C. of F, do the decomposition from last slide

Functional dependencies Our goal: given a set of FD set, F, find an alternative FD set, G that is: smaller equivalent Bad news: Testing F=G (F+ = G+) is computationally expensive Good news: Canonical Cover algorithm: given a set of FD, F, finds minimal FD set equivalent to F Minimal: can’t find another equivalent FD set w/ fewer FD’s

Canonical Cover Algorithm Given: F = { A  BC, B  CE, A  E, AC  H, D  B} Determines canonical cover of F: Fc = { A  BH, B  CE, D  B} Fc = F No G that is equivalent to F and is smaller than Fc Another example: F = { A  BC, B  C, A  B, AB  C, AC  D} CC Algorithm Fc = { A  BD, B  C}

Canonical Cover Algorithm Basic Algorithm ALGORITHM CanonicalCover (X: FD set) BEGIN REPEAT UNTIL STABLE (1) Where possible, apply UNION rule (A’s axioms) (e.g., A  BC, A  CD becomes A  BCD) (2) remove “extraneous attributes” from each FD (e.g., AB  C, A  B becomes A  B, B  C i.e., A is extraneous in AB  C)

Extraneous Attributes (1) Extraneous is RHS? e.g.: can we replace A  BC with A  C? (i.e. Is B extraneous in A  BC?) (2) Extraneous in LHS ? e.g.: can we replace AB  C with A  C ? (i.e. Is B extraneous in AB  C?) Simple but expensive test: 1. Replace A  BC (or AB  C) with A  C in F F2 = F - {A  BC} U {A  C} or F - {AB  C} U {A  C} 2. Test if F2+ = F+ ? if yes, then B extraneous

Extraneous Attributes A. RHS: Is B extraneous in A  BC? step 1: F2 = F - {A  BC} U {A  C} step 2: F+ = F2+ ? To simplify step 2, observe that F2+ F+ Why? Have effectively removed A  B from F i.e., not new FD’s in F2+) When is F+ = F2+ ? Ans. When (A  B) in F2+ Idea: if F2+ includes: A  B and A  C, then it includes A  BC

Extraneous Attributes B. LHS: Is B extraneous in A B  C ? step 1: F2 = F - {AB  C} U {A  C} step 2: F+ = F2+ ? To simplify step 2, observe that F+ F2+ Why? A  C “implies” AB  C. therefore all FD’s in F+ also in F2+. i.e., there may be new FD’s in F2+) But AB  C does not “imply” A  C When is F+ = F2+ ? Ans. When (A  C) in F+ Idea: if F+ includes: A  C then it will include all the FD’s of F2+.

Extraneous attributes A. RHS : Given F = {A  BC, B  C} is C extraneous in A  BC? why or why not? Ans: yes, because A  C in { A  B, B  C}+ Proof. 1. A  B 2. B  C 3. A  C transitivity using Armstrong’s axioms

Extraneous attributes B. LHS : Given F = {A  B, AB  C} is B extraneous in AB  C? why or why not? Ans: yes, because A  C in F+ Proof. 1. A  B 2. AB  C 3. A  C using pseudotransitivity on 1 and 2 Actually, we have AA  C but {A, A} = {A}

Canonical Cover Algorithm ALGORITHM CanonicalCover (F: set of FD’s) BEGIN REPEAT UNTIL STABLE (1) Where possible, apply UNION rule (A’s axioms) (2) Remove all extraneous attributes: a. Test if B extraneous in A  BC (B extraneous if (A  B) in (F - {A  BC} U {A  C})+ ) b. Test if B extraneous in AB  C (B extraneous in AB  C if (A  C) in F+)

Canonical Cover Algorithm Example: determine the canonical cover of F = {A  BC, B  CE, A  E} Iteration 1: a. F = { A  BCE, B  CE} b. Must check for upto 5 extraneous attributes - B extraneous in A  BCE? No - C extraneous in A  BCE? yes: (A  C) in { A  BE, B  CE} 1. A  BE -> 2. A  B -> 3. A  CE -> 4. A  C - E extraneous in A  BE?

Canonical Cover Algorithm Example: determine the canonical cover of F = {A  BC, B  CE, A  E} Iteration 1: a. F = { A  BCE, B  CE} b. Must check for upto 5 extraneous attributes - B extraneous in A  BCE? No - C extraneous in A  BCE? Yes - E extraneous in A  BE? 1. A  B -> 2. A  CE -> A  E - E extraneous in B  CE No - C extraneous in B  CE No Iteration 2: a. F = { A  B, B  CE} b. Extraneous attributes: - C extraneous in B  CE No - E extraneous in B  CE No DONE

Canonical Cover Algorithm Find the canonical cover of F = { A  BC, B  CE, A  E, AC  H, D  B} Ans: Fc= { A  BH, B  CE, D  B}

Canonical Cover Algorithm Find two different canonical covers of: F = { A  BC, B  CA, C  AB} Ans: Fc1 = { A  B, B  C, C  A} and Fc2 = { A  C, B  A, C  B}