Lecture 19a The Chase Test for Lossless Join

Slides:



Advertisements
Similar presentations
Review for Final Exam Lecture Week 14. Problems on Functional Dependencies and Normal Forms.
Advertisements

Chapter 3 Notes. 3.1 Functional Dependencies A functional dependency is a statement that – two tuples of a relation that agree on some particular set.
Classroom Exercise: Normalization
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.
Decomposition By Yuhung Chen CS157A Section 2 October
1 Triggers: Correction. 2 Mutating Tables (Explanation) The problems with mutating tables are mainly with FOR EACH ROW triggers STATEMENT triggers can.
Functional Dependencies and Relational Schema Design.
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.
R EVIEW. 22 Exam Su 3:30PM - 6:30PM 2010/12/12 Room C9000.
1 Lecture 7: Normal Forms, Relational Algebra Monday, 10/15/2001.
Third Normal Form (3NF) Zaki Malik October 23, 2008.
Functional Dependencies and Relational Schema Design.
1 Multivalued Dependencies Fourth Normal Form Reasoning About FD’s + MVD’s.
Design Theory for RDB Normal Forms. Lu Chaojun, SJTU 2 Redundant because these info may be figured out by using FD s1  … What’s Bad Design? Redundancy.
Lecture 13: Relational Decomposition and Relational Algebra February 5 th, 2003.
Design Theory for Relational Databases Functional Dependencies Decompositions Normal Forms: BCNF, Third Normal Form Introduction to Multivalued Dependencies.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
1 Database Design: DBS CB, 2 nd Edition Physical RDBMS Model: Schema Design and Normalization Ch. 3.
1 CS122A: Introduction to Data Management Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li.
Lecture 11: Functional Dependencies
Design Theory for Relational Databases
CS 440 Database Management Systems
Design Theory for RDB Normal Forms.
Schedule Today: Next After that Normal Forms. Section 3.6.
Higher Forms of Normalization
CS411 Database Systems 08: Midterm Review Kazuhiro Minami 1.
Module 5: Overview of Database Design -- Normalization
Problem Axiom of addition:
Schedule Today: Jan. 23 (wed) Week of Jan 28
Plan for Today Normal forms
Chapter 8: Relational Database Design
3.1 Functional Dependencies
Handout 4 Functional Dependencies
Dependency Preservation
Problems in Designing Schema
Relational Design Theory
BCNF and Normalization
Cse 344 May 18th – Loss and views.
CPSC-310 Database Systems
Module 5: Overview of Normalization
Normalization Murali Mani.
Functional Dependencies and Normalization
How to test Whether Subschemes in BCNF??
Exercise R(A,B,C,D) with FD’s ABC, CD, and DA
Functional Dependencies and Normalization
Sridhar Narayan Normalization Sridhar Narayan
Cse 344 May 16th – Normalization.
Functional Dependencies and Relational Schema Design
Introduction to Database Systems CSE 444 Lectures 8 & 9 Database Design October 12 & 15, 2007.
Lecture 09: Functional Dependencies, Database Design
Decomposition of relational schemes
Relational Data Base Design in Practice
Normalization Part II cs3431.
Lecture 8: Database Design
Lecture 07: E/R Diagrams and Functional Dependencies
Normalization cs3431.
Some slides are from Dr. Sara Cohen
Instructor: Mohamed Eltabakh
Relational Database Design
Boyce-Codd Normal Form
Chapter 19 (part 1) Functional Dependencies
Third Normal Form.
Multivalued Dependencies
Anomalies Boyce-Codd Normal Form 3rd Normal Form
Lecture 6: Functional Dependencies
Lecture 11: Functional Dependencies
Chapter 3: Design theory for relational Databases
Chapter 7a: Overview of Database Design -- Normalization
Lecture 09: Functional Dependencies
CS4222 Principles of Database System
Presentation transcript:

Lecture 19a The Chase Test for Lossless Join

Lossless Decomposition We say if a decomposition is lossless if the original relation can be recovered completely by natural joining the decomposed relations. Three important facts to remember: The natural join is associative. That is, the order of the relation join does not mater. Any tuple t in R is surely in the joined decomposed relations. If we can prove any tuple t in joined relation R1 u R2 u … u Rk is also in R, we have a 1-1 mapping between R and re-joined relation, thus a lossless decomposition.

Chase Test The chase test is an organized way to see whether a tuple t in joined relation R1 u R2 u … u Rk can be proved using FDs also to be a tuple in R. We will show through an example how the process works.

Notations Assume R has attributes A, B, … We use a, b, … for the components of t. For ti, we use the same letter as in the components that are in Si, but we subscript the letter with i if the component is not in i. The example in next slide will clarify the notation.

Example Suppose we have relation R(A,B,C,D) and FD’s AB, BC, CDA. Assume we have decomposed R into relations with sets of attributes S1={A,D}, S2={A,C}, and S3={B,C,D}. Then the tableau (re-joined) for this decomposition looks as follows. A B C D a b1 c1 d b2 c d2 a3 b Note: 1. Attribute letters with subscript mean that they are arbitrary values. 2. Attributes with subscripts are “free” values that eventually will be proved not.

Chasing 0 Our goal is to prove those rows with subscripted attributes are really in original R. We “chase” the tableau by applying FDs repeatedly until the relation becomes R. In the next a few slides, we will see how the tableau evolves when FDs are applied

Chase 1 Because the first two rows agree on attribute A, they must also agree on attribute B by the FD {AB}, so the tableau evolves into A B C D a b1 c1 d c d2 a3 b The red colored subscript indicates the change, in this case from b2 to b1.

Chase 2 Because the first two rows now agree on attribute B, they must also agree on attribute C by the FD {BC}, thus c and c1 must be the same. So the tableau evolves into A B C D a b1 c d d2 a3 b The red colored subscript indicates the change, in this case c1 to c.

Chase 3 We know {CDA}, checking row 1 and row 3, a and a3 must agree. So the tableau evolves into A B C D a b1 c d d2 b The red colored subscript indicates the change, in this case a3 to a. At this point, we see that last row becomes (a,b,c,d) which is the original R. Other rows must agree as well.

Let’s revisit some early examples Name SSN PhoneNumber City Fred 123-45-6789 206-555-1234 Seattle 206-555-6543 Joe 987-65-4321 908-555-2121 Madison 908-555-1234 {SSN}  {Name,City} This FD is bad because it is not a superkey, {SSN} can’t determine {PhoneNumber} ⟹ Not in BCNF

R is decomposed into R1 and R2 Name SSN City Fred 123-45-6789 Seattle Joe 987-65-4321 Madison {SSN}  {Name,City} This FD is now good because it is the key SSN PhoneNumber 123-45-6789 206-555-1234 206-555-6543 987-65-4321 908-555-2121 908-555-1234 Now in BCNF! R can be recovered by joining R1 and R2!