0% found this document useful (0 votes)
40 views

L12 de Normalization

The document discusses denormalization techniques to improve query performance in data warehouses. It explains that denormalization involves carefully bringing related data together from normalized tables to reduce joins and improve access to time-series data. The key denormalization techniques covered are collapsing tables, splitting tables horizontally and vertically, pre-joining tables, and adding redundant columns. Guidelines are provided around analyzing costs and benefits before applying denormalization.

Uploaded by

Taiba Hameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

L12 de Normalization

The document discusses denormalization techniques to improve query performance in data warehouses. It explains that denormalization involves carefully bringing related data together from normalized tables to reduce joins and improve access to time-series data. The key denormalization techniques covered are collapsing tables, splitting tables horizontally and vertically, pre-joining tables, and adding redundant columns. Guidelines are provided around analyzing costs and benefits before applying denormalization.

Uploaded by

Taiba Hameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Advance Database Management System – Fall 2023

DeNormalization
Lecture 12
Fahad Maqbool
Department of Computer Science

University of Sargodha
Advance Database Management System – Fall 2023

Balance Between Good & Evil


De-normalization Normalization
Too many tables
4+ Normal Forms

3rd Normal Form

2nd Normal Form

Data Cubes 1st Normal Form

Data Lists

Flat Table One big flat file

University of Sargodha
Advance Database Management System – Fall 2023

What is DeNormalization?
• It is not chaos, more like a “controlled crash” with the aim of
performance enhancement without loss of information.

• Normalization is a rule of thumb in DBMS, but in DSS ease of use is


achieved by way of denormalization.

• De-normalization comes in many flavors, such as combining tables,


splitting tables, adding data etc., but all done very carefully.

University of Sargodha
Advance Database Management System – Fall 2023

What is DeNormalization?
• Bringing “close” dispersed but related data items.

• Query performance in DSS significantly dependent on physical data


model.

• Very early studies showed performance difference in orders of magnitude


for different number de-normalized tables and rows per table.

• The level of de-normalization should be carefully considered.

University of Sargodha
Advance Database Management System – Fall 2023

DeNormalization Improves Performance


• De-normalization specifically improves performance by either:

• Reducing the number of tables and hence the reliance on joins, which
consequently speeds up performance.

• Reducing the number of joins required during query execution, or

• Reducing the number of rows to be retrieved from the Primary Data


Table.

University of Sargodha
Advance Database Management System – Fall 2023

DeNormalization Guidelines
• Carefully do a cost-benefit analysis (frequency of use, additional
storage, join time).

• Do a data requirement and storage analysis.

• Weigh against the maintenance issue of the redundant data (triggers


used).

• When in doubt, don’t denormalize.

University of Sargodha
Advance Database Management System – Fall 2023

• Dealing with the abundance of star schemas.

• Fast access to time series data for analysis.


• Fast aggregate (sum, average, etc.) results and complicated calculations.

• Multidimensional analysis (e.g., geography) in a complex hierarchy.

• Dealing with few updates but many join queries.

University of Sargodha
Advance Database Management System – Fall 2023

Five DeNormalization Principles


1. Collapsing Tables.
a. Two entities with a One-to-One relationship.
b. Two entities with a Many-to-Many relationship.

2. Splitting Tables (Horizontal/Vertical Splitting).

3. Pre-Joining.

4. Adding Redundant Columns (Reference Data).

5. Derived Attributes (Summary, Total, Balance etc).


University of Sargodha
Advance Database Management System – Fall 2023

ColA ColB
Collapsing Tables
denormalized

ColA ColB ColC


normalized

ColA ColC

 Reduced storage space.

 Reduced update time.

 Does not changes business view.

 Reduced foreign keys.

 Reduced indexing.

University of Sargodha
Advance Database Management System – Fall 2023
Table Table_v1 Table_v2

Splitting ColA ColB ColC ColA ColB ColA ColC

Vertical Split
Table_h1 Table_h2

ColA ColB ColC ColA ColB ColC

Horizontal split
University of Sargodha
Advance Database Management System – Fall 2023

Horizontal Splitting
• Breaks a table into multiple tables based upon common column
values. Example: Campus specific queries.

• GOAL

• Spreading rows for exploiting parallelism.

• Grouping data to avoid unnecessary query load in WHERE clause.


University of Sargodha
Advance Database Management System – Fall 2023

Horizontal Splitting: Advantages


• Enhance security of data.

• Organizing tables differently for different queries.

• Graceful degradation of database in case of table damage.

• Fewer rows result in flatter B-trees and fast data retrieval.

University of Sargodha
Advance Database Management System – Fall 2023

Vertical Splitting
• Infrequently accessed columns become extra “baggage” thus degrading
performance.

• Very useful for rarely accessed large text columns with large headers.

• Header size is reduced, allowing more rows per block, thus reducing I/O.

• Splitting and distributing into separate files with repeating primary key.

• For an end user, the split appears as a single table through a view.

University of Sargodha
Advance Database Management System – Fall 2023

Pre Joining
• Identify frequent joins and append the tables together in the physical
data model.

• Generally used for 1:M such as master-detail. RI is assumed to exist.

• Additional space is required as the master information is repeated in


the new header table.

University of Sargodha
Advance Database Management System – Fall 2023
Master

Pre Joining Sale_ID Sale_date Sale_person

normalized
1 M
Tx_ID Sale_ID Item_ID Item_Qty Sale_Rs Detail

Tx_ID Sale_ID Sale_date Sale_person Item_ID Item_Qty Sale_Rs


denormalized

University of Sargodha
Advance Database Management System – Fall 2023

Pre Joining
• Typical of Market basket query

• Join ALWAYS required

• Tables could be millions of rows

• Squeeze Master into Detail

• Repetition of facts. How much?

• Detail 3-4 times of master


University of Sargodha

You might also like