Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Chapter Five
Physical Database Design
1
Objectives
Understand Purpose of physical database design
Describe the physical database design process
Choose storage formats for attributes
Describe indexes and their appropriate use
2
Logical vs Physical Database Design
Logical database design is independent of
implementation details, such as functionality of target
DBMS.
Logical database design concerned with the what,
physical database design is concerned with the how.
Physical Design is description of the implementation of
the database on secondary storage using the target
DBMS
3
Physical Database Design
Process of producing a description ofimplementation of the database on secondarystorage.
The main tasks including: field specification, choosing indexes and file organization, and to refine the conceptual and external schemas (if necessary) to meet performance goals.
4
Cont…
The primary goal of physical database design is data
processing efficiency (Time and Storage impact)
We will concentrate on choices often available to
optimize performance of database services
Many physical database design decisions are implicit
in the technology adopted
5
Cont…
Design decision about Storage Format
Choosing the storage format of each field (attribute).
The DBMS provides some set of data types that can be
used for the physical storage of fields in the database
Data Type (format) is chosen to optimize storage space
and maximize data integrity
6
7
Cont…
It is also called Designing Fields Field
Smallest unit of named application data recognized by system software
Attributes from relations will be represented as fields In addition to Choosing data type you may also
consider Coding (optional) Controlling data integrity
Data Type A coding scheme recognized by system software for
representing organizational data
7
Cont…
Choosing Data Types
CHAR–fixed-length character
VARCHAR–variable-length character (memo)
LONG–large number
NUMBER–positive/negative number
INEGER–positive/negative whole number
DATE–actual date
BLOB–binary large object (good for graphics, sound
clips, etc.)
8
Cont…
Objectives of choosing data types Minimize storage space
Represent all possible values of the field
Improve data integrity of the field
Support all data manipulations desired on the
field
9
10
Example storage format (field design) for
the “Branch” table
10
11
Cont…
Choose indexes Index in a database is similar to an index in a book Primary indexes is automatic by the primary key Clustering index- by non key attribute
Guidelines for Choosing Indexes Specify a unique index for the primary key of each table. Specify an index for foreign keys. Specify an index for nonkey fields that are referenced in
qualification, sorting and grouping commands for the purpose of retrieving data.
11
Rules for Using Indexes
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
12
Rules for Using Indexes (cont.)
6. Avoid use of indexes for fields with long values; perhaps compress values first
7. DBMS may have limit on number of indexes per table and number of bytes per indexed field(s)
8. Null values will not be referenced from an index
9. 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
13
End Of Chapter Five
14