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

Optimization Strategy

Uploaded by

Tan Yi Ting
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Optimization Strategy

Uploaded by

Tan Yi Ting
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Optimization Strategy

Objectives

• Meaning of denormalization.
• When to denormalize to improve performance.

Module Code & Module Title Slide Title SLIDE 2


Introduction

• Result of normalization is a design that is structurally


consistent with minimal redundancy.
• However, sometimes a normalized database does not
provide maximum processing efficiency.
• May be necessary to accept loss of some benefits of a
fully normalized design in favor of performance.

Module Code & Module Title Slide Title SLIDE 3


Introduction

• Also consider that denormalization:


– makes implementation more complex;
– often sacrifices flexibility;
– may speed up retrievals but it slows down updates.

Module Code & Module Title Slide Title SLIDE 4


What is Denormalization

• Denormalization refers to a refinement to


relational schema such that the degree of
normalization for a modified relation is less
than the degree of at least one of the original
relations.
• Also use term more loosely to refer to
situations where two relations are combined
into one new relation, which is still normalized
but contains more nulls than original relations.

Module Code & Module Title Slide Title SLIDE 5


When to apply denormalization

• Consider denormalization in following situations,


specifically to speed up frequent or critical
transactions:
– Combining 1:1 relationships
– Duplicating non-key attributes in 1:* relationships to reduce joins
– Duplicating foreign key attributes in 1:* relationships to reduce joins
– Introducing repeating groups
– Partitioning relations

Module Code & Module Title Slide Title SLIDE 6


Sample Relation Diagram

Module Code & Module Title Slide Title SLIDE 7


Sample Relations

Module Code & Module Title Slide Title SLIDE 8


Combining 1:1 relationships

Module Code & Module Title Slide Title SLIDE 9


Combining 1:1 relationships

Module Code & Module Title Slide Title SLIDE 10


Duplicating non-key attributes in 1:*
relationships to reduce joins

SELECT p.*, o.lName


FROM PropertyForRent p, PrivateOwner o
WHERE p.ownerNo = o.ownerNo AND branchNo = ‘B003’;

Module Code & Module Title Slide Title SLIDE 11


Duplicating non-key attributes in 1:* relationships to reduce joins

SELECT p.*
FROM PropertyForRent p
WHERE branchNo = ‘B003’;

Module Code & Module Title Slide Title SLIDE 12


Duplicating non-key attributes in 1:* relationships: Lookup Table

Module Code & Module Title Slide Title SLIDE 13


Duplicating non-key attributes in 1:* relationships: Lookup Table

Module Code & Module Title Slide Title SLIDE 14


Duplicating FK attributes in 1:* relationship to reduce
joins

Module Code & Module Title Slide Title SLIDE 15


Duplicating FK attributes in 1:* relationship to reduce joins

Module Code & Module Title Slide Title SLIDE 16


Introducing repeating groups

Module Code & Module Title Slide Title SLIDE 17


Partitioning relations

• Rather than combining relations together,


alternative approach is to decompose them into
a number of smaller and more manageable
partitions.
• Two main types of partitioning: horizontal and
vertical.

Module Code & Module Title Slide Title SLIDE 18


Partitioning relations

Module Code & Module Title Slide Title SLIDE 19


Advantages and disadvantages of denormalization

Module Code & Module Title Slide Title SLIDE 20


Q&A

Module Code & Module Title Slide Title SLIDE 21

You might also like