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

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

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

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

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

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

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

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

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

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

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

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

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

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

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

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

End Of Chapter Five

14