Dependency Preservation

Slides:



Advertisements
Similar presentations
Schema Refinement: Normal Forms
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Normalization 1 Instructor: Mohamed Eltabakh Part II.
Logical Database Design (3 of 3) John Ortiz. Lecture 7Logical Database Design (2)2 Normalization  If a relation is not in BCNF or 3NF, we refine it by.
Schema Refinement and Normal Forms Given a design, how do we know it is good or not? What is the best design? Can a bad design be transformed into a good.
CS 440 Database Management Systems Practice problems for normalization.
LOSSLESS DECOMPOSITION Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Review for Final Exam Lecture Week 14. Problems on Functional Dependencies and Normal Forms.
Normalization theory exercises Dr. Shiyong Lu Department of Computer Science Wayne State University ©copyright 2007, all rights reserved.
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.
7.1 Chapter 7: Relational Database Design. 7.2 Chapter 7: Relational Database Design Features of Good Relational Design Atomic Domains and First Normal.
CS Algorithm : Decomposition into 3NF  Obviously, the algorithm for lossless join decomp into BCNF can be used to obtain a lossless join decomp.
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Decomposition By Yuhung Chen CS157A Section 2 October
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 Triggers: Correction. 2 Mutating Tables (Explanation) The problems with mutating tables are mainly with FOR EACH ROW triggers STATEMENT triggers can.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design Algorithms by Pinar Senkul resources: mostly froom Elmasri, Navathe.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Normal Forms1. 2 The Problems of Redundancy Redundancy is at the root of several problems associated with relational schemas: Wastes storage Causes problems.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
DAVID DENG CS157B MARCH 23, 2010 Dependency Preserving Decomposition.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
CSCI 4333 Database Design and Implementation – Exercise (3) Xiang Lian The University of Texas – Pan American Edinburg, TX
SCUJ. Holliday - coen 1784–1 Schedule Today: u Normal Forms. u Section 3.6. Next u Relational Algebra. Read chapter 5 to page 199 After that u SQL Queries.
THIRD NORMAL FORM (3NF) A relation R is in BCNF if whenever a FD XA holds in R, one of the following statements is true: XA is a trivial FD, or X is.
Third Normal Form (3NF) Zaki Malik October 23, 2008.
Temple University – CIS Dept. CIS331– Principles of Database Systems V. Megalooikonomou Database Design and Normalization (based on notes by Silberchatz,Korth,
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
© 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.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
1 Dept. of CIS, Temple Univ. CIS661 – Principles of Data Management V. Megalooikonomou Database design and normalization (based on slides by C. Faloutsos.
Relational Data Model, Review Relation Tuple Attribute Domains Candidate key, primary key Key attribute, non-key attribute.
1 CS122A: Introduction to Data Management Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li.
Schedule Today: Next After that Normal Forms. Section 3.6.
Relational Database Design
Module 5: Overview of Database Design -- Normalization
Normalization First Normal Form (1NF) Boyce-Codd Normal Form (BCNF)
Database Design Dr. M.E. Fayad, Professor
Relational Database Design by Dr. S. Sridhar, Ph. D
Relational Database Design
CS 480: Database Systems Lecture 22 March 6, 2013.
Relational Database Design
3.1 Functional Dependencies
Chapter 7: Relational Database Design
BCNF and Normalization
Module 5: Overview of Normalization
Chapter 7: Relational Database Design
Normalization Murali Mani.
CSCI 4333 Database Design and Implementation – Exercise (3)
How to test Whether Subschemes in BCNF??
Review  Only two chapters (6 & 7) Normalization Theory Triggers.
Normalization Part II cs3431.
Normalization cs3431.
Some slides are from Dr. Sara Cohen
Relational Database Design
Boyce-Codd Normal Form
Designing Relational Databases
Instructor: Mohamed Eltabakh
Third Normal Form.
Anomalies Boyce-Codd Normal Form 3rd Normal Form
Database Design Dr. M.E. Fayad, Professor
CSCI 6315 Applied Database Systems – Exercise (5)
Chapter 7a: Overview of Database Design -- Normalization
Functional Dependencies and Normalization
Functional Dependencies and Normalization
CS4222 Principles of Database System
Presentation transcript:

Dependency Preservation

What makes a "good" decomposition? Elimination of Anomalies Recoverability of Information Preservation of Dependencies? Is it important to be able to check all FD's (without needing to do a join)?

Normalization Using Functional Dependencies When we decompose a relation schema R with a set of functional dependencies F into R1, R2,.., Rn we want Lossless-join decomposition: Otherwise decomposition would result in information loss. Dependency preservation: Let Fi be the set of dependencies F+ that include only attributes in Ri (F1  F2  …  Fn)+ = F+

Are both decompositions in BCNF? R = {A, B, C} F = {A → B, B → C} Can be decomposed in two different ways Decomposition #1 R1 = {A, B}, R2 = {B, C} Decomposition #2 R1 = {A, B}, R2 = {A, C} 1. Yes, all the sub-relations are in BCNF 2. No, the left sub-relations are not both in BCNF 3. No, the right sub-relations are not both in BCNF 4. No, (B → C) isn't preserved

Dependency Preservation R = {A, B, C} F = {A → B, B → C} Can be decomposed in two different ways R1 = {A, B}, R2 = {B, C} Lossless-join decomposition R1  R2 = {B} and B → BC Dependency preserving R1 = {A, B}, R2 = {A, C} Lossless-join decomposition: R1  R2 = {A} and A → AB Not dependency preserving (cannot check B → C without computing join of R1 and R2)

Testing for Dependency Preservation To check if a dependency  →  is preserved in a decomposition of R into R1, R2, …, Rn, we apply the following simplified test (with attribute closure done with regard to F) result =  while (changes to result) do for each Ri in the decomposition t = (result  Ri)+  Ri result = result  t If result contains all attributes in , then the functional dependency  →  is preserved. We apply the test on all dependencies in F to check if a decomposition is dependency preserving This procedure takes polynomial time Instead of the exponential time required to compute F+ and (F1  F2  …  Fn)+

AnimeTraits ( name, hair_color, tsundere, eye_size) FDs = Is decomposition into Hair (name, hair_color), HotHead(name , tsundere) and BigEyed (name, eye_size) dependency preserving? 1. Yes 2. No, (name → hair_color) isn't preserved 3. No, (hair_color → tsundere) isn't preserved 4. No, my sanity isn't preserved