1 / 51

Databasesystemer

Databasesystemer. Data Structure, Storage and Processing Architectures. 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. Goals.

faye
Download Presentation

Databasesystemer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Databasesystemer Data Structure, Storage and Processing Architectures Data Structure and storage Object-oriented Data Management

  2. 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

  3. 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

  4. Database access Data Structure and storage Object-oriented Data Management

  5. A disk Disk head Disk arm Rotation Arm movement Tracks, bloks and sectors Cylinder Data Structure and storage Object-oriented Data Management

  6. 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

  7. 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

  8. Indexing Data Structure and storage Object-oriented Data Management

  9. Multiple indexes Data Structure and storage Object-oriented Data Management

  10. Sparse indexes Data Structure and storage Object-oriented Data Management

  11. 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

  12. 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

  13. Linked list Data Structure and storage Object-oriented Data Management

  14. Join indexes Data Structure and storage Object-oriented Data Management

  15. 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

  16. A D C B E Y X R-tree searching Data Structure and storage Object-oriented Data Management

  17. 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

  18. 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

  19. 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

  20. On-line Data Storage • Harddisk • RAID • “Mirroing” • “Stripping” Data Structure and storage Object-oriented Data Management

  21. Mirroring Data Structure and storage Object-oriented Data Management

  22. Striping Data Structure and storage Object-oriented Data Management

  23. 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

  24. Databasesystemer Object-oriented Data Management Data Structure and storage Object-oriented Data Management

  25. 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

  26. Data and OO modeling Data Structure and storage Object-oriented Data Management

  27. Key concepts • Object instances and classes • Encapsulation • Message passing • Generalization/specialization hierarchies • Inheritance Data Structure and storage Object-oriented Data Management

  28. 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

  29. 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

  30. 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

  31. 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

  32. 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

  33. Layers of an OO model • Class and object layer • Structure layer • Attribute layer • Service layer Data Structure and storage Object-oriented Data Management

  34. 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

  35. Structure layer • Generalization/specialization • Whole/part Data Structure and storage Object-oriented Data Management

  36. Object model – take 1 Data Structure and storage Object-oriented Data Management

  37. Attribute layer • Specification of attributes • Specification of association relationships • Specification is similar to data modeling Data Structure and storage Object-oriented Data Management

  38. Object model - final version Data Structure and storage Object-oriented Data Management

  39. 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

  40. 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

  41. 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

  42. 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

  43. 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

  44. 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

  45. Class Exercise • Convert the following class diagram to • ER diagram Data Structure and storage Object-oriented Data Management

  46. OO and relational paradigms Data Structure and storage Object-oriented Data Management

  47. 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

  48. 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

  49. 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

  50. 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

More Related