0% found this document useful (0 votes)
23 views25 pages

Electricity

Uploaded by

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

Electricity

Uploaded by

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

Fundamentals of Database Systems (ITEC 2071)

Chapter Five

Physical Database Design

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

Note: To estimate size and usage patterns of the database.


Chapter Five: Physical Database Design
7
7
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

Note: PURCHASED PART andChapter


QUOTATION are candidates for denormalization.
Five: Physical Database Design
11
11
Designing Fields
 Field
Smallest unit of data in database
Correspond to a simple attribute from the E-R diagram
 Field design
1. Choosing data types
2. Coding techniques
3. Controlling data integrity
4. Handling missing values

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)

Code saves space, but costs an


additional lookup to obtain actual
value and additional space for the
look-up table.

Note: Acceptable if Finish field is infrequentlyused. 15


Chapter Five: Physical Database Design 15
3. Controlling Data Integrity
 Control on the possible values a field can assume
Default value
⚫ value a field will assume unless a user enters an explicit value for that field
Range control
⚫ limits the set of permissible values a field can assume

Null value control


⚫ allowing or prohibiting empty fields

⚫ e.g. primary keys

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

 Improves performance by allowing multiple users to access the same data at


the same time with minimum contention
 Sacrifices data integrity due to data duplication
 Best for data that is not updated often

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.

Chapter Five: Physical Database Design 23


Clustering Files
 In some relational DBMSs, related records from different tables can be stored together in the
same disk area and useful for improving performance of join operations.
 Primary key records of the main table are stored adjacent to associated foreign key records of
the dependent table
 e.g. Oracle has a CREATE CLUSTER command
 Clustering Files
1. Use on larger tables
2. Index the primary key of each table
3. Index search fields (fields frequently in WHERE clause)
4. Fields in SQL ORDER BY and GROUP BY commands
5. When there are >100 values but not when there are <30 values
6. DBMS may have limit on number of indexes per table and number of bytes per indexed field(s)
7. Null values will not be referenced from an index
8. Use indexes heavily for non-volatile databases; limit the use of indexes for volatile databases
Why? Because modifications (e.g. inserts, deletes) require updates to occur in index files
24
Chapter Five: Physical Database Design 24
Fundamentals of Database Systems (ITEC 2071)

Thank
You

Information Technology
Jimma Institute of Technology

You might also like