Decomposition and Higher Forms of Normalization

Slides:



Advertisements
Similar presentations
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.
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.
Normalization DB Tuning CS186 Final Review Session.
Normalization DB Tuning CS186 Final Review Session.
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 Multi-valued Dependencies. 2 Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized. Consider a.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Introduction to Schema Refinement
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Copyright © Curt Hill Schema Refinement III 4 th NF and 5 th NF.
Normal Forms1. 2 The Problems of Redundancy Redundancy is at the root of several problems associated with relational schemas: Wastes storage Causes problems.
Schema Refinement and Normalization. Functional Dependencies (Review) A functional dependency X  Y holds over relation schema R if, for every allowable.
BCNF & Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
Functional Dependencies and Normalization R&G Chapter 19 Lecture 26 Science is the knowledge of consequences, and dependence of one fact upon another.
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:
Tallahassee, Florida, 2015 COP4710 Database Systems Relational Design Fall 2015.
Announcements Program 3 due Friday Homework 2 out today, due Mon Read: Chapter 3.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
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.
Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts.
1 CS122A: Introduction to Data Management Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li.
Normalization Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 19.
Advanced Normalization
Chapter 15 Relational Design Algorithms and Further Dependencies
Schedule Today: Next After that Normal Forms. Section 3.6.
Gergely Lukács Pázmány Péter Catholic University
COP4710 Database Systems Relational Design.
Schema Refinement and Normal Forms
Higher Forms of Normalization
CS411 Database Systems 08: Midterm Review Kazuhiro Minami 1.
Module 5: Overview of Database Design -- Normalization
Normalization First Normal Form (1NF) Boyce-Codd Normal Form (BCNF)
Normal Forms.
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.
Chapter 8: Relational Database Design
3.1 Functional Dependencies
Handout 4 Functional Dependencies
Advanced Normalization
Chapter 7: Relational Database Design
Schema Refinement and Normalization
11/12/2018.
Relational Design Theory
Fourth normal form: 4NF.
Schema Refinement and Normalization
Schema Refinement and Normalization
Module 5: Overview of Normalization
Normalization Murali Mani.
Functional Dependencies and Normalization
Functional Dependencies
Multivalued Dependencies & Fourth Normal Form
Multivalued Dependencies & Fourth Normal Form
Relational Design Theory
Normalization Part II cs3431.
Schema Refinement and Normalization
CS 405G: Introduction to Database Systems
Schema Refinement and Normal Forms
NORMALIZATION FIRST NORMAL FORM (1NF):
Schema Refinement and Normalization
Database Design Dr. M.E. Fayad, Professor
Chapter 3: Multivalued Dependencies
Chapter 7a: Overview of Database Design -- Normalization
Functional Dependencies and Normalization
Presentation transcript:

Decomposition and Higher Forms of Normalization Chapter 15.8 (skim) 1/17/2019

"Lossless" Joins The main idea: if you decompose a relation schema, then join the parts of an instance via a natural join, you might get more rows than you started with, i.e., spurious tuples This is bad! Called a "lossy join". Goal: decompositions which produce only "lossless" joins "non-additive" join is more descriptive 1/17/2019

Preserving FDs What if, when a relation is decomposed, the X of an XY ends up only in one of the new relations and the Y ends up only in another? Such a decomposition is not “dependency-preserving.” Goal: Always have FD-preserving decompositions 1/17/2019

Decomposing R Into BCNF Pick an X-> A which violates BCNF, where A is a single attribute. Decompose so that R1={X,A} is in one relation, R2=R-A is in the other. Repeat if necessary on R2. Guaranteed lossless... but may lose dependencies SBD with SB->D, D->B 1/17/2019

Decomposing R into 3NF The algorithm is much more complicated 1. Get a “minimal cover” of FDs 2. Find a lossless-join decomposition of R (which might miss dependencies) 3. Add additional relations to the decomposition to cover any missing FDs of the cover Result will be lossless, will be dependency-preserving 3NF; might not be BCNF 1/17/2019

Fact of life... Finding a decomposition which is both lossless and dependency-preserving is not always possible. 1/17/2019

Contracts schema CSJDPQV Contracts (cid, supplierid, projectid, deptid, partid, qty, value) cid is a key; JP -> C; SD -> P What are candidate keys? BCNF, 3NF decompositions? What if J->S is added? 1/17/2019

Multivalued Dependencies (MVDs) XY means that given X, there is a unique set of possible Y values (which do not depend on other attributes of the relation) PARENTNAMECHILDNAME An FD is also a MVD MVD problems arise if there are two independent 1:N relationships in a relation. 1/17/2019

Textbook Example (3-way pun) course, teacher, book Each teacher teaches a set of courses teacher  courses Each course has a recommended set of books (independent of teacher) course  book No FDs! 1/17/2019

MVD Theory A whole theory exists, analogous to FD theory Armstrong’s axioms plus 5 additional rules 1/17/2019

Fourth Normal Form A relation R is in 4NF if for every nontrivial XY, X is a superkey of R. Decomposition into 4NF: If there is a non-trivial XY, form one relation with only X and Y, and another with R-Y. In other words, allow only one MVD per relation This will be lossless, but not necessarily FD-preserving. Achieving 4NF is a trade-off 1/17/2019

Fifth Normal Form Sometimes a relation cannot be losslessly decomposed into two relations, but can be into three or more. 5NF captures the idea that a relation scheme must have some particular lossless decomposition ("join dependency"). Finding actual 5NF cases is difficult. 1/17/2019

Normalization Summary 1NF: usually part of the woodwork even so, know how to decompose 2NF: usually skipped but lots of defs. that make great exam Q's! 3NF: a biggie Always aim for this BCNF and 4NF: tradeoffs start here in re: d-preserving and losslessness 5NF: You can say you've heard of it... 1/17/2019

Caveat Normalization is not the be-all and end-all of DB design Example: suppose attributes A and B are always used together, but normalization theory says they should be in different tables. Decomposition might produce unacceptable performance loss (extra disk reads) Plus -- there are constraints other than FDs and MVDs 1/17/2019

Looking Ahead: One Query Is Usually Not Enough A meaningful unit of DB work might involve doing one or more queries, checking constraints, performing calculations, interacting with user, etc. Such a unit is termed a "transaction" "Transaction Processing" will be our next topic 1/17/2019

Current Trends Object DBs and Object-Relational DB’s Data Warehouses May permit complex attributes 1st normal form unnecessary Data Warehouses Huge historical databases, seldom or never updated after creation Joins expensive or impractical Argues against normalization Every-day Relational DBs Aim for BCNF, settle for 3NF 1/17/2019