21
CT004-3-3 ADVBS Introduction & Overview Optimization Strategy CT004-3.5-3 Advanced Database Systems

Optimization Strategy

Embed Size (px)

Citation preview

Page 1: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Optimization Strategy

CT004-3.5-3 Advanced Database Systems

Page 2: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Objectives

Meaning of denormalization. When to denormalize to improve

performance.

Page 3: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

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.

Page 4: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Introduction

Also consider that denormalization: makes implementation more complex often sacrifices flexibility may speed up retrievals but it slows down

updates

Page 5: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

What is Denormalization

Denormalization refers to Refinement to relational schema Degree of normalization for a modified relation is

less than the degree of at least one of the original relations.

Term used more loosely to refer to Situations where two relations are combined into

one new relation New relation is still normalized but contains more

nulls than original relations.

Page 6: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

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

Page 7: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Sample Relation Diagram

Page 8: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Sample Relations

Page 9: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Combining 1:1 relationships

Page 10: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Combining 1:1 relationships

Page 11: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

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

SELECT p.*, o.lNameFROM PropertyForRent p, PrivateOwner oWHERE p.ownerNo = o.ownerNo AND branchNo = ‘B003’;

Page 12: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

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

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

Page 13: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

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

Page 14: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

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

Page 15: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Duplicating FK attributes in 1:* relationship to reduce joins

Page 16: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Duplicating FK attributes in 1:* relationship to reduce joins

Page 17: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Introducing repeating groups

Page 18: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

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.

Page 19: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Partitioning relations

Page 20: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Advantages and disadvantages of denormalization

Page 21: Optimization Strategy

CT004-3-3 ADVBS Introduction & Overview

Q & A