Sunteți pe pagina 1din 14

Physical Database Design

MGIS 641

Ko University

Learning objectives

Define the terms: Physical database design, and its major objectives. Describe five major components of physical DB design. Describe the purpose of data volume and usage analysis. Describe four basic data distribution strategies. Describe basic purposes of indexes. Define referential integrity.

Introduction

Physical database design is the last stage of DB design process. Major objective is to implement the the DB as a set of stored records, files, indexes etc that will provide adequate performance and ensure DB integrity, security and recoverability.

DB development process
Planning Enterprise data model

Analysis
Conceptual data model Logical DB design Logical data model Physical DB design Technology model Implementation DB & repositories

Physical DB Design Process

Three major inputs :


Logical DB Structures User Processing requirements, size, frequency of use, response times, security, backup, recovery etc. Characteristics of the DBMS and the computing environment

Components of Physical Design


Data volume & usage analysis Data distribution strategy File organisations Indexes Integrity constraints

Volume Analysis
TREATMENT 4000 (4) (10) Estimated No. of Entity instances CHARGE 10,000 After an Avg. period of 30 days patient records are archived. There are 100 beds on Avg. A patient stays for 3 days. 4 treatments during stay. 10 charges. No. of charges outstanding for an item is 20. A physician treats 20 patients in 30 days. (20) ITEM 500 PATIENT PHYSICIAN (20) 50

1000

Data Usage Analysis


Identify major transactions required Analyse transactions to determine access paths and usage frequency
TRANSACTION ANALYSIS FORM
Transaction No : xxx-555 Transaction Name : Create Patient Bill PATIENT Date :25/5/1996 Transaction Volume : 1 Avg : 2/Hr Max : 10/Hr

Transaction Map : Diagram showing the sequence of logical DB accesses.


No 1 2 3 Name

1000 2 CHARGE 10,000 Type of Access R R R 3 ITEM 500

Entry-PATIENT PATIENT-CHARGE CHARGE-ITEM

No of References Per Trans. Per Period 1 10 10 100 10 100

Composite Usage Map


(75)
TREATMENT 4000 (25) (10) (250) Composite Usage Map : Concise reference to the estimated volume and usage of data in the DB CHARGE 10,000 (50) (125) ITEM 500 (50) (25) (100) PATIENT (60) (25) PHYSICIAN 50

(30)

1000

Composite Usage Map including other types of transactions

Data Distribution Strategy

Basic data distribution strategies : Centralised : All data are centralised at a single site.
Access problems for for remote users, data comms. cost, DB fails when central system fails.

Partitioned

: DB is partitioned into is divided into non-overlapping partitions

and assigned to a particular site. Data closer to local users

Replicated

: A full copy of DB is assigned to more than one site.

Maximise local access, update problems.

Hybrid: DB is fragmented into critical and non-critical fragments, non-critical fragments stored at only one site others at multiple sites.

A Distribution Example
SALE
SALES AREA SALESPERSON PRODUCT-ID QTY-SOLD CUSTOMERTATUS S

PRODUCT
PRODUCT-ID LOCATION QTY-STORED

FIVE TRANSACTIONS : T1 : FIND ALL SALES IN A GIVEN AREA T2: INSERT A NEW SALE T3: SELECT SALES MADE BY A GIVEN SALESPERSON T4: FIND QTY-STORED AND LOCATION FOR A GIVEN PRODUCT -ID T5: FIND LOCATION THAT HAS MORE THAN A GIVEN QTY-STORED OF A GIVEN PRODUCT-ID

A Distribution Example
T1 SITE-A SELECT PRODUCT-ID, QTYSTORED, CUSTOMER FROM SALE WHERE AREA=SITE-A (2000) INSERT SALES ROW INTO SALE FOR AREA=SITE-A (300) SITE-B SELECT PRODUCT-ID, QTYSTORED, CUSTOMER FROM SALE WHERE AREA=SITE-B (500) INSERT SALES ROW INTO SALE FOR AREA=SITE-B (300) SITE-C SELECT PRODUCT-ID, QTYSTORED, CUSTOMER FROM SALE WHERE AREA=SITE-C (500) INSERT SALES ROW INTO SALE FOR AREA=SITE-C (300)

T2

T3

SELECT PRODUCT-ID, QTYSTORED, CUSTOMER FROM SALE WHERE SALESPERSON="ANY" NO TRANSACTIONS FROM (800) THIS SITE

T4

T5

NO TRANSACTIONS FROM THIS SITE SELECT QTY-STORED, LOCATION FROM PRODUCT NO TRANSACTIONS FROM NO TRANSACTIONS FROM WHERE PRODUCT-ID="ANY" THIS SITE THIS SITE (1000) SELECT LOCATION FROM SELECT LOCATION FROM SELECT LOCATION FROM PRODUCT WHERE PRODUCT WHERE PRODUCT- PRODUCT WHERE PRODUCTPRODUCT-ID="ANY" AND ID="ANY" AND QTY-STORED> ID="ANY" AND QTY-STORED> QTY-STORED> "ANY" (2000) "ANY" (2000) "ANY" (2000)

SALE RELATION
A B C
FRAGMENT A SALES FROM SITE-A FRAGMENT A SALES FROM SITE-B FRAGMENT A SALES FROM SITE-C

FREQUENCY OF ACCESS PRODUCT RELATION D


NOT FRAGMENTED

A Distribution Example
USE OF FRAGMENTS
TRANSACTION ORIGIN AND FREQUENCY SITE-A (2000) T1 SITE-B (500) SITE-C (500) SITE-A (300) T2 SITE-B (300) SITE-C (300) SITE-A (800) T3 SITE-B (0) SITE-C (0) SITE-A (0) T4 SITE-B (0) SITE-C (1000) SITE-A (2000) T5 SITE-B (500) SITE-C (500) A 1 0 0 1 0 0 0.67 0 0 0 0 0 0 0 0 B 0 1 0 0 1 0 0.165 1 0 0 0 0 0 0 0 C 0 0 1 0 0 1 0.165 0 0 0 0 1 0 0 1 D 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1

ALLOCATION OF FRAGMENTED RELATIONS A--> SITE-A B--> SITE-B C--> SITE C D -- SITE A POSSIBLE REPLICATION AT SITE-C

File Organisation

File organisation : A technique for physically arranging the records of a file on secondary storage, Indexes

Index : A table or other data structure that is used to determine the locations of rows in a table that satisfy a condition.

PRODUCT
PRODUCT NO

0100 0400 0050 0625

DESCRIPTION Table Table Desk Chair

FINISH Oak Mahogony Pine Oak


RECORD NO 3 1 2 4

ROOM DR SR SR DR

UNIT PRICE 500 600 400 100

PRODUCT NO 0050 0100 0400 0625

Index tables are small and can be kept in the main memory.

When to Use Indexes


Specify an index for primary key Specify index for foreign keys Specify index for nonkey attributes that are referred to in qualification, sorting, and grouping commands (e.g. WHERE, ORDER BY, GROUP BY)

S-ar putea să vă placă și