Chapter Five Physical Database...
Transcript of Chapter Five Physical Database...
![Page 1: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/1.jpg)
Chapter Five
Physical Database Design
1
![Page 2: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/2.jpg)
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
![Page 3: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/3.jpg)
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
![Page 4: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/4.jpg)
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
![Page 5: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/5.jpg)
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
![Page 6: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/6.jpg)
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
![Page 7: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/7.jpg)
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
![Page 8: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/8.jpg)
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
![Page 9: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/9.jpg)
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
![Page 10: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/10.jpg)
10
Example storage format (field design) for
the “Branch” table
10
![Page 11: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/11.jpg)
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
![Page 12: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/12.jpg)
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
![Page 13: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/13.jpg)
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
![Page 14: Chapter Five Physical Database Designfdbs.weebly.com/uploads/6/6/1/2/66126761/fundamentals_of_datab… · Physical Database Design Process of producing a description of implementation](https://reader034.fdocuments.us/reader034/viewer/2022050502/5f948b50cf4cac0a7d2f1e8b/html5/thumbnails/14.jpg)
End Of Chapter Five
14