Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a...

31
Object Persistence Design Chapter 13

Transcript of Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a...

Page 1: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Object Persistence Design

Chapter 13

Page 2: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Key Definitions

Object persistence involves the selection of a storage format and optimization for performance.Four basic formats used for object persistence are: files, OO databases, object-relational, and relational databases.

Page 3: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

OBJECT PERSISTENCE FORMATS

Page 4: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Files

Sequential AccessData stored in order based on a particular attribute Typically efficient for reports using all or most of the file’s data

Random AccessData stored in unordered fashionTypically efficient for finding individual records

Page 5: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Other files

Master filesTransaction filesAuditHistoryLook-up

Page 6: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Customer Order File

Figure 13-1 Goes Here

Page 7: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Relational Databases

Primary keyForeign keyReferential integrityStructured Query Language (SQL)TablesJoining tablesObjects must be converted so they can be stored in a table

Page 8: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Object-Relational Databases

Relational databases extended to handle the storage of objectsUse of user-defined data typesExtended SQLInheritance tends to be language dependent

Page 9: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Relational Database Example

Figure 13-3 Goes Here

Page 10: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Object-Oriented DatabasesTwo approaches

Adding persistence extensions to OO languagesSeparate database management systems

Extents Object ID assigned Some inheritance Repeating groups or multivalued

attributes Mainly support multimedia

applications Sharp learning curve

Page 11: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Selecting an Object Persistence Format

Page 12: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

MAPPING PROBLEM DOMAIN OBJECTS TO OBJECT PERSISTENCE FORMATS

Page 13: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Initial Points to Consider

Adding primary and foreign keysUnless they add too much overhead

Data management functionality

only in classes at data management layer

May add overhead, but aids in portability and reuse

Page 14: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Appointment System Problem Domain and Data Management

Layers

Page 15: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Factoring Out Multiple Inheritance Effect

Page 16: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Mapping Problem Domain Objects to ORDBMS Schema -- Rules

Page 17: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Mapping Problem Domain Objects to ORDBMS Schema -- Example

Page 18: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Maintain a Clean Problem Domain Layer

Modifying the problem domain layer can create problems between the system architecture and human computer interface layerThe development and production costs of OODBMS may offset the production cost of having the data management layer implemented in ORDBMS

Page 19: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Mapping Problem Domain Objects to RDBMS Schema -- Rules

Page 20: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

OPTIMIZING RDBMS-BASED OBJECT STORAGE

Page 21: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Dimensions of Data Storage Optimization

Storage efficiency (minimizing storage space)Speed of access (minimizing time to retrieve desired information)

Page 22: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Optimizing Storage Efficiency

Reduce redundant dataLimit null values

Multiple possible interpretations can lead to mistakes

A well-formed logical data model does not contain redundancy or many null values

Page 23: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

The Steps of Normalization

Page 24: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

First Normal Form (1NF)

Page 25: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Second Normal Form (2NF)

Page 26: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Third Normal Form (3NF)

Page 27: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Optimizing Access Speed

DenormalizationClustering

Intra-fileInter-file

Indexing

Page 28: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Payment Type Index

Page 29: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Guidelines for Creating Indexes

Use indexes sparingly for transaction systemsUse many indexes to increase response times in decision support systemsFor each table

Create a unique index based on the primary keyCreate an index based on the foreign key

Create an index for fields used frequently for grouping, sorting, or criteria

Page 30: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

Estimating Data Storage Size

Field Average Size (Characters)

Order number 8Date 7Cust ID 4Last name 13First name 9State 2Amount 4Tax rate 2Record Size 49Overhead (30%) 14.7Total Record Size 63.7

Initial Table Size 50,000Initial Table Volume 3,185,000

Growth/Month 1,000Table volume @ 3 years 5,478,200

Page 31: Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.

SummaryThere are four basic types of object persistence formats: files (sequential and random access), object-oriented databases, object-relational databases, and relational databases.Tradeoffs between the formats make it necessary to consider which to apply in each environmentOnce the format has been selected, data storage needs to be optimized for efficiency and speed of access.