510 likes | 639 Vues
This guide explores database architectures, focusing on data structure, storage, and processing architectures. It covers database goals such as timely query responses and minimizing costs associated with data processing, storage, and delivery. We discuss various data storage structures, indexing methods like B-trees, and the importance of clustering and sequential retrieval. Additionally, the document delves into object-oriented data management concepts, including encapsulation, inheritance, and how these practices translate to relational models. It serves as a comprehensive resource for database professionals.
E N D
Databasesystemer Data Structure, Storage and Processing Architectures Data Structure and storage Object-oriented Data Management
Learning objectives • Be able to explain what a database architecture is and what goals the design strives to achieve. • Know different data storage structures and storage devices, and when to use them. Data Structure and storage Object-oriented Data Management
Goals • An architecture should • Respond to queries in a timely manner • Minimize the cost of processing data • Minimize the cost of storing data • Minimize the cost of data delivery • These objectives can be conflicting Data Structure and storage Object-oriented Data Management
Database access Data Structure and storage Object-oriented Data Management
A disk Disk head Disk arm Rotation Arm movement Tracks, bloks and sectors Cylinder Data Structure and storage Object-oriented Data Management
Clustering • Records that are often retrieved together should be stored together • Intra-file clustering • Inter-file clustering Data Structure and storage Object-oriented Data Management
Sequential retrieval • Consider a file of 10,000 records each occupying 1 page • Queries that require processing all records will require 10,000 accesses • e.g., Find all items of type 'E' • Many disk accesses are wasted if few records meet the condition Data Structure and storage Object-oriented Data Management
Indexing Data Structure and storage Object-oriented Data Management
Multiple indexes Data Structure and storage Object-oriented Data Management
Sparse indexes Data Structure and storage Object-oriented Data Management
B-tree (B+ tree) • Sequence set is a single level index with pointers to records • Index set is a tree-structured index to the sequence set Data Structure and storage Object-oriented Data Management
Hashing hash address = remainder after dividing SSN by 10000 S S N D i s k a d d r e s s F i l e s p a c e O v e r f l o w a r e a 4 1 7 - 0 3 - 4 3 5 6 } 4 3 5 6 4 1 7 - 0 3 - 4 3 5 6 5 3 2 - 6 7 - 4 3 5 6 5 3 2 - 6 7 - 4 3 5 6 8 9 1 - 5 5 - 4 3 5 6 • • S y n o n y m c h a i n } 0 4 3 - 1 5 - 1 8 9 3 1 8 9 3 0 4 3 - 1 5 - 1 8 9 3 8 9 1 - 5 5 - 4 3 5 6 • • } 2 8 1 - 2 7 - 1 5 0 2 1 5 0 2 2 8 1 - 2 7 - 1 5 0 2 • Data Structure and storage Object-oriented Data Management
Linked list Data Structure and storage Object-oriented Data Management
Join indexes Data Structure and storage Object-oriented Data Management
A D C B E Y X X Y I n d e x s e t A B D E S e q u e n c e s e t C R-trees Data Structure and storage Object-oriented Data Management
A D C B E Y X R-tree searching Data Structure and storage Object-oriented Data Management
Fysisk design og tuning • Hvad er databasens arbejdsbelastning? • Hvilke index skal oprettes? • Skal der ske tilpasning i de ”conceptual schema” af performance hensyn? Data Structure and storage Object-oriented Data Management
Guidelines for valg af index • Hvornår der oprettes et index? • Valg af en søge nøgle for indexet. • Hvornår anvendes ”multiple-attribute” søge nøgle? • Hvornår skal der foretages ”clustering”? • Valget mellem ”hash” og B+ tree. • Index – omkostning for vedligeholdelse. Data Structure and storage Object-oriented Data Management
Data storage devices • What data storage device will be used for • On-line data • Access speed • Capacity • Back-up files • Security against data loss • Archival data • Long-term storage Data Structure and storage Object-oriented Data Management
On-line Data Storage • Harddisk • RAID • “Mirroing” • “Stripping” Data Structure and storage Object-oriented Data Management
Mirroring Data Structure and storage Object-oriented Data Management
Striping Data Structure and storage Object-oriented Data Management
Storage life Magnetic tape Half-inch reel-to-reel Half-inch tape cartridge VHS tape Quarter-inch tape Optical disk CD-ROM (read only) CD-R (recordable) Microfilm Medium-term film Archival quality (silver) Paper Newspaper High quality Permanent 1 10 100 500 Storage life in years of high quality brands Data Structure and storage Object-oriented Data Management
Databasesystemer Object-oriented Data Management Data Structure and storage Object-oriented Data Management
Learning objectives • Explain the main concepts of object-orientation. • Mapping a simple object-oriented model to a relational model. Data Structure and storage Object-oriented Data Management
Data and OO modeling Data Structure and storage Object-oriented Data Management
Key concepts • Object instances and classes • Encapsulation • Message passing • Generalization/specialization hierarchies • Inheritance Data Structure and storage Object-oriented Data Management
Object instances and classes • Object instance • Single representations • Object classes • A collection of objects of the same type • e.g., SHARE • Similar concept to an entity • Object identification (OID) • Unique reference to an object instance Data Structure and storage Object-oriented Data Management
Encapsulation • A central concept • All the processing is done within the object • An object is shielded from interference by other objects Data Structure and storage Object-oriented Data Management
Message passing • Objects communicate by sending and receiving messages • The receiving object needs a method for handling the message • A message can trigger a change in a receiving object Data Structure and storage Object-oriented Data Management
Generalization/specialization hierarchies • Classes can be generalizations or specializations of other classes • ACADEMIC PERSON is a generalization of subclasses student and staff • STUDENT is a specialization of superclass ACADEMIC PERSON Data Structure and storage Object-oriented Data Management
Inheritance • A subclass can inherit the data and methods of its superclass • Simplifies programming • Creates reusable objects Data Structure and storage Object-oriented Data Management
Layers of an OO model • Class and object layer • Structure layer • Attribute layer • Service layer Data Structure and storage Object-oriented Data Management
Object layer • Identifying objects and classes • Underline the nouns in the problem description Customers can rent diving equipment and boats from DDT. When a customer has seen what is available and decided what to rent, a rental agreement or contract is produced and signed Data Structure and storage Object-oriented Data Management
Structure layer • Generalization/specialization • Whole/part Data Structure and storage Object-oriented Data Management
Object model – take 1 Data Structure and storage Object-oriented Data Management
Attribute layer • Specification of attributes • Specification of association relationships • Specification is similar to data modeling Data Structure and storage Object-oriented Data Management
Object model - final version Data Structure and storage Object-oriented Data Management
Service layer • Describes processing for each specified object • Simple services • Standard services all objects are expected to perform • Implicit and not shown • Complex • Non-standard services • Shown explicitly Data Structure and storage Object-oriented Data Management
Class Diagram to ER Diagram • To Convert... • Each class becomes an entity • Class attributes become entity attributes • Type information is maintained • Operation information is ignored • Each association becomes a relationship • Multiplicity information is maintained • IsA Relationship should become an IsA (super/sub) relationships • SA does not do this translation • Overcome be manually adding an entity equivalent to the class and then created a relationship of type super/sub Data Structure and storage Object-oriented Data Management
ER Diagram to Database Tables • Use entity names for table names • Select a primary key for each entity/table • Post all attributes of an entity as column names in the entity’s table • For 1:1 cardinality relationships • All attributes can be merged into a single table • For 1:N cardinality relationships • Post the identifier from the “one” side as an attribute to the “many” side • For N:M cardinality relationships • Create a new table and post the primarykeys from each entity as attributes in the new table Data Structure and storage Object-oriented Data Management
Mapping attributes • Each attribute is mapped to zero or more columns • Non-persistent (i.e., derived) attributes are not mapped • Some attributes need to be broken into components Data Structure and storage Object-oriented Data Management
MappingGeneralization • Vertical • Each class is mapped to a separate table • Recommended • Horizontal • Each subclass is mapped to a different table • The superclass is not mapped to a table • Filtered • All classes are mapped to the same table • The table contains columns for all attributes in both classes with a column added to distinguish between the subclasses. Data Structure and storage Object-oriented Data Management
MappingAssociation and aggregation • Associations are mapped like their corresponding data model parallels • e.g., a m:m association is mapped by creating an associative entity • Physically, an aggregation might be implemented using clustering or a linked list because the whole and parts are often retrieved together Data Structure and storage Object-oriented Data Management
Class Exercise • Convert the following class diagram to • ER diagram Data Structure and storage Object-oriented Data Management
OO and relational paradigms Data Structure and storage Object-oriented Data Management
The role of the ODBMS • Objects have a life that extends beyond the execution of the OO program • Persistent objects live longer than the methods that create them • An ODBMS stores data when the OO application is not running Data Structure and storage Object-oriented Data Management
Features of an ODBMS • An ODBMS should supports OO concepts • complex objects • abstract data types • encapsulation • inheritance • An ODBMS also should provides • data sharing • concurrent data access • recovery control Data Structure and storage Object-oriented Data Management
The Object Database Standard • The OMG (Object Management Group) is creating and promulgating a standard for OO technology • The goal is to minimize incompatibility across platforms and standardize some features • OMG has released an Object Database Standard Data Structure and storage Object-oriented Data Management
ODBMS versus RDBMS • Support for storage and manipulation of complex objects • Raised the level of abstraction by introducing classes and inheritance • Overcomes the impedance mismatch • Set level processing with SQL makes ad hoc querying easier than record-at-a-time processing Data Structure and storage Object-oriented Data Management