* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download PPT
Survey
Document related concepts
Transcript
Concepts of Database Management Eighth Edition Chapter 9 Database Management Approaches Objectives • Describe distributed database management systems (DDBMSs) • Discuss client/server systems • Examine the ways databases are accessed on the Web • Discuss XML and related document specification standards ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 2 Objectives (continued) • Define data warehouses and explain their structure and access • Discuss the general concepts of object-oriented DBMSs ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 3 Distributed Databases • Computers at various sites • Connected with communications network or network • Distributed database: single logical database physically divided among networked computers • Distributed database management system (DDBMS): supports and manipulates distributed databases ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 4 Distributed Databases (continued) FIGURE 9-1: Communications network ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 5 Distributed Databases (continued) • Computers in a network communicate through messages • Access delay required for every message – Fixed amount of time • Communication time = access delay + (data volume / transmission rate) ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 6 Characteristics of Distributed DBMSs • Homogeneous DDBMS: same local DBMS at each site • Heterogeneous DDBMS: at least two sites at which local DBMSs are different • Shared characteristics of DDBMSs – Location transparency – Replication transparency – Fragmentation transparency ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 7 Location Transparency • Remote site: site other than one where user is • Local site: site where user is • Location transparency: users do not need to be aware of location of data in a distributed database ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 8 Replication Transparency • Data replication creates update problems that can lead to data inconsistencies • Replication transparency: users unaware of steps taken by DDBMS to update various copies of data ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 9 Fragmentation Transparency • Data fragmentation: DDBMS can divide and manage a logical object among various locations under its control – Data placed at the location where it is most often accessed • Fragmentation transparency: users unaware of fragmentation ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 10 Fragmentation Transparency (continued) FIGURE 9-2: TAL Distributors Item table data ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 11 Fragmentation Transparency (continued) FIGURE 9-3: Fragmentation of Item table data by storehouse ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 12 Advantages of Distributed Databases • • • • Local control of data Increased database capability System availability Improved performance ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 13 Disadvantages of Distributed Databases • Update of replicated data – Primary copy • More complex query processing • More complex treatment of concurrent update – Local deadlock: occurs at a single site in a distributed database – Global deadlock: involves more than one site • More complex recovery measures – Two-phase commit: one site acts as coordinator ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 14 Disadvantages of Distributed Databases (continued) • More difficult management of data dictionary • More complex database design • More complicated security and backup requirements ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 15 Rules for Distributed Databases (C.J. Date) 1. 2. 3. 4. 5. 6. Local autonomy No reliance on a central site Continuous operation Location transparency Fragmentation transparency Replication transparency ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 16 Rules for Distributed Databases (continued) 7. Distributed query processing 8. Distributed transaction management 9. Hardware independence 10. Operating system independence 11. Network independence 12. DBMS independence ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 17 Client/Server Systems • File server architecture – File server: stores user files on the network • Client/server architecture – Server: computer providing data to clients • Back-end processor or back-end machine – Clients: computers connected to a network and used by users to access data • Front-end processor or front-end machine ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 18 Client/Server Systems (continued) FIGURE 9-4: File server architecture ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 19 Client/Server Systems (continued) FIGURE 9-5: Two-tier client/server architecture ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 20 Client/Server Systems (continued) • Two-tier architecture – Server performs database functions – Clients perform presentation functions • Fat client • Thin client • Three-tier architecture – Clients perform presentation functions – Database server performs database functions – Application servers perform business functions and interface between clients and database server ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 21 Client/Server Systems (continued) FIGURE 9-6: Three-tier client/server architecture ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 22 Advantages of Client/Server Systems • • • • • Lower network traffic Improved processing distribution Thinner clients Greater processing transparency Increased network, hardware, and software transparency • Improved security • Decreased costs • Increased scalability ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 23 Web Access to Databases • • • • • Internet and World Wide Web (or the Web) Web page: digital document on the Web Web server: stores Web pages Web client: computer requesting a Web page Each Web page has a Uniform Resource Locator (URL) • Hypertext Transfer Protocol (HTTP): data communication method used to exchange data on the Internet ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 24 Web Access to Databases (continued) • Web browser: computer program that retrieves a Web page from a Web client • Transmission Control Protocol/Internet Protocol (TCP/IP): standard protocol for communication on the Internet • Web pages usually created using Hypertext Markup Language (HTML) ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 25 Web Access to Databases (continued) FIGURE 9-7: Retrieving a Web page on the Internet ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 26 Web Access to Databases (continued) • Static vs. dynamic Web pages – Static Web pages: same content for all Web clients – Dynamic Web pages: content changes in response to inputs and choices from Web clients • Server-side extensions or server-side scripts • Client-side extensions or client-side scripts • Three-tier Web-based architecture – Web clients – Web server – Database server ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 27 Web Access to Databases (continued) FIGURE 9-8: Three-tier Web-based architecture ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 28 XML • HTML – Describes content and appearance of Web pages – Does not describe structure and meaning of data • Extensible Markup Language (XML) – Tags can define meaning and structure of data – An XML document should begin with an XML declaration ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 29 XML (continued) • Extensible Hypertext Markup Language (XHTML) – Markup language based on XML – Stricter version of HTML • Defining structure, characteristics, and relationships of data – Document Type Definition (DTD) – XML schema • Presentation of data – Stylesheet ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 30 XML (continued) FIGURE 9-10: XML schema for the Rate element from the Rep table ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 31 XML (continued) FIGURE 9-11: Interaction among XML and related languages ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 32 Data Warehouses • Online transaction processing (OLTP) systems – Users use transactions when interacting with an RDBMS • Data warehouse – Subject-oriented, integrated, time-variant, nonvolatile collection of data in support of management’s decision-making process – Used for analysis of existing data – Resolves performance issues suffered by operational RDBMSs and OLTPs ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 33 Data Warehouses (continued) FIGURE 9-12: Data warehouse architecture ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 34 Data Warehouse Structure and Access • Star schema – Fact table – Dimension table • Online analytical processing (OLAP) software: for access to a data warehouse • Data cube: a shape for visualizing a data warehouse as a multidimensional database • Data mining: uncovering new knowledge, patterns, trends, and rules from data in a data warehouse ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 35 Data Warehouse Structure and Access (continued) FIGURE 9-13: A star schema with four dimension tables and a central fact table ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 36 Data Warehouse Structure and Access (continued) FIGURE 9-14: A data cube representation of the Item, Customer, and Time dimensions ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 37 Rules for OLAP Systems (E.F. Codd) 1. 2. 3. 4. 5. 6. Multidimensional conceptual view Transparency Accessibility Consistent reporting performance Client/server architecture Generic dimensionality ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 38 Rules for OLAP Systems (continued) 7. Dynamic sparse matrix handling 8. Multiuser support 9. Unrestricted, cross-dimensional operations 10. Intuitive data manipulation 11. Flexible reporting 12. Unlimited dimensions and aggregation levels ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 39 Sample Data Warehouse • Microsoft Wide World Importers: • https://github.com/Microsoft/sql-serversamples/releases/tag/wide-world-importers-v1.0 ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 40 NOSQL Databases • NOSQL databases refer to any database that’s does not use SQL and does not have a tabular structure of storage. • NOSQL Databases came about because of relational databases provided no flexibility with its structure and suffered from poor performance. • Type of NOSQL Databases: – – – – Document Databases Graph Databases Key Value Databases Wide Column Databases 41 NOSQL Databases • Document databases pair each key with a complex data structure known as a document. Documents can contain many different keyvalue pairs, or key-array pairs, or even nested documents. • Graph databases are used to store information about networks of data, such as social connections. Graph stores include Neo4J and Giraph. • Key-value databases store items as an attribute name (or 'key'), together with its value. Examples of key-value stores are Riak and Berkeley DB. Some key-value stores, such as Redis, allow each value to have a type, such as 'integer', which adds functionality. • Wide-column databases such as Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows. 42 MongoDB Document Database • An example of a popular document database is MongoDB. • A document DB does not have to rely on joins to retrieve data that is not stored together, thus outperforming relational DBs. • MongoDB stores data as documents in a binary representation called BSON (Binary JSON). • Documents that’s shared a similar structure are organized together as collections. 43 MongoDB Document Database • A collection can be thought of as a table in a relational database. • Documents are schemaless, so two documents in the same collection do not have to have the same schema. 44 MongoDB Document Database • MongoDB documents represents the data using JSON { '_id' : 1, 'name' : { 'first' : 'John', 'last' : 'Backus' }, 'contribs' : [ 'Fortran', 'ALGOL', 'Backus-Naur Form', 'FP' ], 'awards' : [ { 'award' : 'W.W. McDowell Award', 'year' : 1967, 'by' : 'IEEE Computer Society' }, { 'award' : 'Draper Prize', 'year' : 1993, 'by' : 'National Academy of Engineering' } ] } • Queries can be composed in javascript 45 MongoDB Document Database • Documents stored in a collection require a unique ID “_Id” field that as a primary key. • Operations: – – MongoDB Query: SQL-like Equivalent: db.inventory.find({}) select * from inventory – – MongoDB Query: SQL-like Equivalent: db.inventory.find({status:”D”}) select * from inventory where status = “D” – – MongoDB Insert: SQL-like Equivalent: db.inventory.insertOne( { item: "card", qty: 15 } ); insert into inventory (document structure) – MongoDB Update: – SQL-like Equivalent: db.inventory.updateOne( { item: "paper" }, { $set: { "size.uom": "cm", status: "P" },}) update inventory set size.uom = cm, status = P where item = paper 46 MongoDB Document Database • Advantages of MongoDB over RDBMS – – – – – – No rigid schema to follow Structure of single object is clear No complex joins needed Powerful query ability Easer to scale out Mapping of application objects (ORM) is not needed ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 47 Object-Oriented DBMSs • Complex objects: graphics, drawings, photographs, video, sound, voice mail, spreadsheets, etc. • RDBMSs store complex objects using special data types – Binary large objects (BLOBs) • Object-oriented DBMSs used with applications whose focus is on complex objects ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 48 What Is an Object-Oriented DBMS? • Object: set of related attributes along with associated actions • Object-oriented database management system (OODBMS): database management system in which data and associated actions are encapsulated into objects • Example: ObjectDB (Java Based) ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 49 Objects and Classes • Represent each entity as an object rather than a relation • List attributes vertically below object names – Follow each attribute by name of domain • Objects can contain other objects • An object can contain a portion of another object ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 50 Methods and Messages • Methods: actions defined for a class • Defined during data definition process • Executed when user sends a message to the object ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 51 Methods and Messages (continued) FIGURE 9-22: Two methods for the TAL Distributors object-oriented database ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 52 Inheritance • Subclass – Every occurrence of subclass is considered an occurrence of the class – Subclass inherits structure and methods of the class ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 53 Unified Modeling Language (UML) • Used to model all aspects of software development for object-oriented systems – Includes a way to represent database designs • Class diagram: most relevant diagram type for database design – Rectangles represent classes – Lines joining classes represent relationships; called associations – Visibility symbol indicates whether other classes can view or update value in attribute ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 54 Unified Modeling Language (UML) (continued) FIGURE 9-24: Class diagram for the TAL Distributors database ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 55 Unified Modeling Language (UML) (continued) • Multiplicity: number of objects that can be related to an individual object • Constraints • Superclass • Generalization: relationship between a superclass and a subclass ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 56 Unified Modeling Language (UML) (continued) FIGURE 9-26: Class diagram with a generalization and a constraint ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 57 Rules for OODBMSs 1. 2. 3. 4. 5. 6. 7. Complex objects Object identity Encapsulation Information hiding Types of classes Inheritance Late binding ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 58 Rules for OODBMSs (continued) 8. Computational completeness 9. Extensibility 10. Persistence 11. Performance 12. Concurrent update support 13. Recovery support 14. Query facility ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 59 Summary • Distributed database: single logical database physically divided among computers at several sites on a network • Location transparency, replication transparency, and fragmentation transparency are important characteristics of DDBMSs • Two-tier client/server architecture: DBMS runs on file server and server sends only the requested data to the clients ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 60 Summary (continued) • Three-tier client/server architecture: clients perform presentation functions, database servers perform database functions, and application servers perform business functions • Web servers interact with Web clients using HTTP and TCP/IP to display HTML Web pages • Dynamic Web pages, not static Web pages, are used in e-commerce • XML was developed because of need for data exchange between organizations and inability of HTML to specify structure and meaning of data ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 61 Summary (continued) • XHTML: markup language based on XML; stricter version of HTML • Data warehouse: subject-oriented, integrated, timevariant, nonvolatile collection of data in support of management’s decision-making process • Users perceive data in a data warehouse as a multidimensional database in data cube shape • Data mining: uncovering new knowledge, patterns, trends, and rules from data stored in a data warehouse ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 62 Summary (continued) • Object-oriented DBMSs deal with data as objects – Object: set of related attributes and actions associated with the attributes – OODBMS: database management system in which data and actions that operate on the data are encapsulated into objects • UML: an approach to model all aspects of software development for object-oriented systems ©2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 63