Electricity
Electricity
Chapter Five
Information Technology
Jimma Institute of Technology
Looping
Outline
• Physical Database Design Process
• Designing Fields
• Designing Physical Records and Denormalization
• Designing Physical Files
Database development activities during SDLC
3
Chapter Five: Physical Database Design 3
Physical Database Design
Purpose
Translate the logical description of data into the technical specifications for
storing and retrieving data
Goal
Create a design for storing data that will provide adequate performance and
ensure database integrity, security and recoverability
Balance between efficient storage space and processing speed
Efficient processing tend to dominate as storage is getting cheaper
4
Chapter Five: Physical Database Design 4
Physical Design Process
Inputs
⚫ Normalized relations
Key Decisions
⚫ Volume estimates ⚫ Attribute data types
⚫ Frequency of use estimates ⚫Physical record descriptions (doesn’t
always match logical design)
⚫ Attribute definitions
⚫ File organizations
⚫ Response time expectations
Leads to ⚫ Indexes and database architectures
⚫Data security, backup,
recovery, and integrity ⚫ Query optimization
requirements
⚫ DBMS technology used
5
Chapter Five: Physical Database Design 5
Composite Usage Map
To estimate data volume and frequency of use statistics
First step in physical database design or last step in logical database
design
Add notations to the EER diagram
6
Chapter Five: Physical Database Design 6
Figure 5-1: Composite Usage Map
Data volumes
8
Chapter Five: Physical Database Design 8
Figure 5-1: Composite Usage Map
Access Frequencies
(per hour)
9
Chapter Five: Physical Database Design 9
Figure 5-1: Composite Usage Map
Usage analysis:
200 purchased parts accessed
per hour ➔
80 quotations accessed from
these 200 purchased part
accesses ➔
70 suppliers accessed from
these 80 quotation accesses
10
Chapter Five: Physical Database Design 10
Figure 5-1: Composite Usage Map
Usage analysis:
75 suppliers accessed per
hour ➔
40 quotations accessed from
these 75 supplier accesses ➔
40 purchased parts accessed
from these 40 quotation
accesses
12
Chapter Five: Physical Database Design 12
1. Choosing Data Types
Correct data type to choose for a field should
minimize storage space
represent all possible values
improve data integrity (eliminate illegal values)
support all data manipulations
Examples of data types
CHAR: fixed-length character
VARCHAR2: variable-length character
CLOB: capable of storing up to 4GB (e.g. customer’s comment)
NUMBER: positive/negative number
DATE: actual date and time
BLOB: binary large object (e.g. photograph or sound clip)
13
Chapter Five: Physical Database Design 13
2. Coding Techniques
Some attributes may be very large
These data are further apart; results in slower data processing
Create a code look-up table
A lookup table is a data structure that maps input keys to output values, commonly
implemented as a table, array, or dictionary. It enhances efficiency by precomputing and
storing results for quick access.
14
Chapter Five: Physical Database Design 14
Figure 5-2: Code look-up table (Pine Valley Furniture Company)
Referential integrity
⚫ range control for foreign-key to primary-key match-ups
16
Chapter Five: Physical Database Design 16
4. Handling Missing Data
Substitute an estimate of the missing value
e.g. using some formula
Trigger areport listing missing values
Perform sensitivity analysis
missing data are ignored unless knowing a value might be significant
17
Chapter Five: Physical Database Design 17
Designing Physical Records
Physical record
a group of fields stored in adjacent memory locations and
retrieved or written together as a unit by a DBMS
Sometimes, the normalized relation may not be converted
directly into a physical record
often all the attributes in a relation are not used together, and data from
different relations are needed together to produce a report
efficient processing of data depends on how close together related data are
18
Chapter Five: Physical Database Design 18
Denormalization
Process of transforming normalized relations into unnormalized
physical record specifications
either by joining files, partitioning files or data replication
Benefit
improve processing speed
Costs
more storage space needed
data integrity and inconsistency threats
19
Chapter Five: Physical Database Design 19
Partitioning
Create more tables
Horizontal partitioning
distributing the rows of a table into several separate files
useful for situations where different users need access to different rows
Vertical partitioning
distributing the columns of a table into several separate files
the primary key must be repeated in each file
useful for situations where different users need access to different columns
Combinations of horizontal and vertical partitioning
useful for database distributed across multiple computers (distributed database)
20
Chapter Five: Physical Database Design 20
Data Replication
Purposely storing the same data in multiple locations of the database
21
Chapter Five: Physical Database Design 21
Designing Physical Files
File organization: is the way data is physically stored on a disk or storage
medium.
It impacts the efficiency of data retrieval, storage, and updates.
Choosing the appropriate file organization depends on the application’s requirements for
speed, flexibility, and storage.
There are commonly three types:
1. Sequential file organization: Records are stored in a sequential order, based on the
primary key or another attribute.
2. Indexed file organization: Records are stored sequentially, and an index is created for
faster access to specific records.
3. Hashed file organization: Records are stored at calculated locations on the disk,
determined using a hash function.
27
Chapter Five: Physical Database Design 22
More popular is indexed sequential file organization:
Combines sequential storage with an index for fast data access and allows
both sequential and direct record retrieval.
Primary key index: Each entry uniquely maps a key to a single record and is
automatically created for primary keys.
Secondary key index: Each entry can map to multiple records and is created on non-
primary key fields
The database management system manages and maintains all indexes.
Thank
You
Information Technology
Jimma Institute of Technology