Database Management


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Database Management

  1. 1. IS698: Database Management Min Song IS NJIT
  2. 2. Overview <ul><li>Data Models, Schemas & Instances </li></ul><ul><li>Three-Schema Architecture and Data Independence </li></ul><ul><li>Database Languages & Interfaces </li></ul><ul><li>Database System Environment </li></ul><ul><li>Centralized DB & Client/Server Architecture </li></ul><ul><li>DBMS Classifications </li></ul>
  3. 3. Data Models
  4. 4. What is a Data Model? <ul><li>An abstract representation </li></ul><ul><li>Hides low level details </li></ul><ul><li>Describes DB structure </li></ul><ul><ul><li>Data types </li></ul></ul><ul><ul><li>Relationships </li></ul></ul><ul><ul><li>Constraints </li></ul></ul><ul><li>+ (current trend) </li></ul><ul><li>Dynamic aspects : E.g. user-defined operations </li></ul>
  5. 5. Data Model: Categories (1/3) <ul><li>High level : from the user perspective </li></ul><ul><ul><li>For end user/customer </li></ul></ul><ul><ul><li>Entity, attribute, relationships </li></ul></ul><ul><ul><li>E-R diagrams </li></ul></ul>
  6. 6. Data Model: Categories (2/3) <ul><li>Low level : how data stored in computer </li></ul><ul><ul><li>For computer specialists/DBMS implementer </li></ul></ul><ul><ul><li>Physical data model </li></ul></ul><ul><ul><li>Record formats, record orderings, access paths </li></ul></ul>
  7. 7. Data Model: Categories (3/3) <ul><li>Representational ( implementation ) model </li></ul><ul><ul><li>Meant for end user </li></ul></ul><ul><ul><li>With some of the data organizational information </li></ul></ul><ul><ul><li>Can be implemented directly in a computer </li></ul></ul><ul><ul><li>E.g. Relational data model </li></ul></ul><ul><ul><li>Out of fashion </li></ul></ul><ul><ul><ul><li>Network data model </li></ul></ul></ul><ul><ul><ul><li>Hierarchical data model </li></ul></ul></ul>
  8. 8. Database Schemas
  9. 9. What is DB Schema? <ul><li>A description of the database (meta-data) </li></ul><ul><li>Covers only some aspects </li></ul><ul><ul><li>E.g. name of record type, data items, some constraints </li></ul></ul><ul><li>Not changed frequently </li></ul><ul><li>Specify when a new database defined </li></ul><ul><li>Meta-data = DBMS Catalog </li></ul><ul><li>Schema constructs : Objects in schema </li></ul><ul><li>Schema diagram </li></ul><ul><ul><li>Convention to display schema </li></ul></ul>
  10. 10. Example: University Database DB Schema A DB Instance Schema Constructs
  11. 11. Database Instances <ul><li>Data in the database at a particular time </li></ul><ul><li>Instance </li></ul><ul><ul><li>= snapshot </li></ul></ul><ul><ul><li>= database state </li></ul></ul><ul><ul><li>~= current set of occurrences </li></ul></ul><ul><li>DB_state(i) </li></ul><ul><li> insert/delete/update </li></ul><ul><ul><li> DB_state(i+1) </li></ul></ul>
  12. 12. Schema, Instances & DB States <ul><li>Define DB schema  DB_state(0) = empty state </li></ul><ul><li>DB_state(0)  populate  initial state </li></ul><ul><li>DB_state(i) is a valid state for all I </li></ul><ul><ul><li>Satisfies the structure and the constraints defined in the schema </li></ul></ul><ul><li>DB Schema = intention of the database </li></ul><ul><li>DB state = extension of the Schema </li></ul>
  13. 13. Three-Schema Architecture
  14. 14. What is Three-Schema Architecture? <ul><li>Important characteristics of a database </li></ul><ul><ul><li>Insulation of programs and data </li></ul></ul><ul><ul><li>Support for multiple user views </li></ul></ul><ul><ul><li>Use of catalogs for schemas </li></ul></ul><ul><li>Three-Schema architecture implements above characteristics </li></ul>
  15. 15. Visualization of Three-Schema Architecture
  16. 16. What is in each Schema? <ul><li>Internal Schema </li></ul><ul><ul><li>Physical storage structure </li></ul></ul><ul><ul><li>data storage details, access path </li></ul></ul><ul><li>Conceptual Schema </li></ul><ul><ul><li>Structure of the entire database </li></ul></ul><ul><ul><li>Entities, data types, relationships, user operations, constraints </li></ul></ul><ul><li>External Schema </li></ul><ul><ul><li>Part of the database interested to a particular user group </li></ul></ul>
  17. 17. Mapping between Database Schemas <ul><li>Process of transforming requests among different database level (schemas) </li></ul><ul><ul><li>Is a overhead in compilation & execution of queries </li></ul></ul><ul><ul><li>Time consuming </li></ul></ul><ul><ul><li>Only some of the DBMSs implements Three-schema architecture </li></ul></ul>
  18. 18. Data Independence
  19. 19. What is Data Independence? <ul><li>Ability to change one level schema without affecting other levels of schema </li></ul><ul><ul><li>Three-schema architecture implements concept of data independence </li></ul></ul><ul><ul><li>Only the mapping need to be changed </li></ul></ul><ul><li>Logical Independence </li></ul><ul><ul><li>Capacity to change conceptual schema without affecting external view (application programs) </li></ul></ul><ul><li>Physical Independence </li></ul><ul><ul><li>Ability to change internal schema without changing the conceptual view </li></ul></ul>
  21. 21. Database Languages
  22. 22. Purpose of a Database Language <ul><li>DDL (Data Definition Languages) </li></ul><ul><ul><li>Conceptual schema </li></ul></ul><ul><ul><li>Internal schemas (when schema separation is not clear) </li></ul></ul><ul><ul><li>External schema (in most DBMSs) </li></ul></ul><ul><li>SDL (Store Definition Languages) </li></ul><ul><ul><li>Internal schema </li></ul></ul><ul><li>VDL (View Definition Languages) </li></ul><ul><ul><li>External view </li></ul></ul><ul><li>DML (Data Manipulation Languages) </li></ul><ul><ul><li>To manipulate the populated data </li></ul></ul><ul><li>Modern DB  All in one  (E.g. SQL ) </li></ul><ul><ul><li>Separate SDL </li></ul></ul>
  23. 23. Data Manipulation Languages <ul><li>High-level ( nonprocedural ) </li></ul><ul><ul><li>Set-at-a-time/set oriented </li></ul></ul><ul><ul><li>Declarative </li></ul></ul><ul><ul><li>Complex DB operations </li></ul></ul><ul><ul><li>Interactive/embedded in programming languages </li></ul></ul><ul><li>Low-level ( procedural ) </li></ul><ul><ul><li>Record-at-a-time </li></ul></ul><ul><ul><li>Embedded in general purpose programming languages </li></ul></ul>
  24. 24. Where the DML is Used? <ul><li>When DML is embedded in program </li></ul><ul><ul><li>Programming Language  host language </li></ul></ul><ul><ul><li>DML  data sub language </li></ul></ul><ul><li>For interactive queries </li></ul><ul><ul><li>DML  query language </li></ul></ul><ul><li>General users </li></ul><ul><ul><li>User friendly interfaces </li></ul></ul>
  25. 25. DBMS Interfaces <ul><li>Menu-Based Web Interfaces </li></ul><ul><li>Forms-Based Interfaces </li></ul><ul><li>Graphical User Interfaces </li></ul><ul><li>Natural Language Interfaces </li></ul><ul><li>Interfaces for parametric Users </li></ul><ul><li>Interfaces for DBA </li></ul>
  26. 26. The Database System Environment
  27. 27. Components of DBMS:
  28. 28. Relational System Architecture <ul><li>Databases are BIG pieces of software. Typically very hard to modularize. Lots of system design decisions at the macro and micro scale. Here we focus on macro design. </li></ul><ul><li>Disk management choices: </li></ul><ul><ul><li>file per relation </li></ul></ul><ul><ul><li>big file in file system </li></ul></ul><ul><ul><li>raw device </li></ul></ul><ul><li>Process Model: </li></ul><ul><ul><li>process per user </li></ul></ul><ul><ul><li>server </li></ul></ul><ul><ul><li>multi-server </li></ul></ul>
  29. 29. Relational System Architecture: Continue <ul><li>Basic modules: </li></ul><ul><ul><li>parser </li></ul></ul><ul><ul><li>query rewrite </li></ul></ul><ul><ul><li>optimizer </li></ul></ul><ul><ul><li>query executor </li></ul></ul><ul><ul><li>access methods </li></ul></ul><ul><ul><li>buffer manager </li></ul></ul><ul><ul><li>lock manager </li></ul></ul><ul><ul><li>log/recovery manager </li></ul></ul>
  30. 30. Relational System Architecture: Continue <ul><li>Query Rewriter </li></ul><ul><ul><li>Flattens views </li></ul></ul><ul><ul><li>may change query semantics (constraints, protection, etc.) </li></ul></ul><ul><li>Optimizer </li></ul><ul><ul><li>large space of equivalent relational plans </li></ul></ul><ul><ul><li>pick one that’s going to be &quot;optimal&quot; </li></ul></ul><ul><ul><li>produces either an interpretable plan tree, or compiled code </li></ul></ul><ul><li>Executor </li></ul><ul><ul><li>modules to perform relation operations like joins, sorts, aggregations, etc. </li></ul></ul><ul><ul><li>calls Access Methods for operations on base and temporary relations </li></ul></ul><ul><li>Access Methods </li></ul><ul><ul><li>uniform relational interface (open, get next), a la INGRES AMI, System R's RSS </li></ul></ul><ul><ul><li>multiple implementations: heap, B-tree, extensible hashing </li></ul></ul>
  31. 31. Relational System Architecture: Continue <ul><li>Buffer Manager </li></ul><ul><ul><li>Intelligent user-level disk cache </li></ul></ul><ul><ul><li>must interact with transaction manager & lock manager </li></ul></ul><ul><li>Lock Manager </li></ul><ul><ul><li>must efficiently support lock table </li></ul></ul><ul><ul><li>System R architecture influential: </li></ul></ul><ul><ul><ul><li>physical and logical locks treated uniformly </li></ul></ul></ul><ul><ul><ul><li>multiple granularity of locks </li></ul></ul></ul><ul><ul><ul><li>set intent locks at high levels </li></ul></ul></ul><ul><ul><ul><li>we will study this in more detail later (Gray) </li></ul></ul></ul><ul><ul><li>deadlock handling: detection </li></ul></ul>
  32. 32. Relational System Architecture: Continue <ul><li>Log/Recovery Manager </li></ul><ul><ul><li>&quot;before/after&quot; log on values </li></ul></ul><ul><ul><li>checkpoint/restore facility for quick recovery </li></ul></ul><ul><ul><li>Redo/Undo on restore </li></ul></ul><ul><ul><li>Support soft crashes off disk, hard crashes off tape. </li></ul></ul><ul><ul><li>System R’s shadowing is too slow. Use Write-Ahead Logging! (WAL) Hard to get right! </li></ul></ul>
  33. 33. Software Components of a DBMS <ul><li>DBMS Component Modules </li></ul><ul><li>Database System Utilities </li></ul><ul><li>Tools </li></ul><ul><li>Application Environments </li></ul><ul><li>Communication Facilities </li></ul>
  34. 34. DBMS Component Modules (1/2)
  35. 35. DBMS Component Modules (2/2) <ul><li>Disk access control </li></ul><ul><ul><li>Stored Data Manager </li></ul></ul><ul><ul><li>OS </li></ul></ul><ul><ul><li>Buffer Manager Module </li></ul></ul><ul><li>Compilers </li></ul><ul><ul><li>DDL Compiler </li></ul></ul><ul><ul><li>Query Compiler </li></ul></ul><ul><ul><li>DML Compiler </li></ul></ul><ul><ul><li>Precompiler/Host language compiler </li></ul></ul><ul><li>Handling DB access at runtime </li></ul><ul><ul><li>Runtime database processor </li></ul></ul>
  36. 36. Database System Utilities <ul><li>Loading : load/transfer using files </li></ul><ul><ul><li>Conversion tools </li></ul></ul><ul><li>Backup : copy/dump databases </li></ul><ul><ul><li>Failure recovery </li></ul></ul><ul><ul><li>Incremental backups </li></ul></ul><ul><li>File reorganization : to improve performance </li></ul><ul><li>Performance/access Monitoring </li></ul><ul><li>Sorting /data compression /interfacing to network </li></ul>
  37. 37. Tools <ul><li>CASE : Computer Aided Software Engineering Tools </li></ul><ul><ul><li>DB designers/DBA/users </li></ul></ul><ul><ul><li>Design phase </li></ul></ul><ul><li>Information repository </li></ul><ul><ul><li>Data dictionary (data repository) systems </li></ul></ul><ul><ul><li>Catalog/design decisions/usage standards/application program descriptions/user information </li></ul></ul>
  38. 38. Application Development Environments <ul><li>E.g. PowerBuilder/JBuilder </li></ul><ul><li>Supports </li></ul><ul><ul><li>Development of database applications </li></ul></ul><ul><ul><li>Database design </li></ul></ul><ul><ul><li>GUI development </li></ul></ul><ul><ul><li>Querying and updating </li></ul></ul>
  39. 39. Communication Software <ul><li>Provide access for remote users </li></ul><ul><li>DB/DC package </li></ul><ul><li>Supports for distributed DBMSs </li></ul>
  40. 40. DBMS Architectures
  41. 41. Centralized DBMSs
  42. 42. Basic Client/Server Architecture <ul><li>Applied for network with </li></ul><ul><ul><li>PCs, workstations, printers, file servers, database servers, web servers, etc </li></ul></ul><ul><li>Specialized server with specific functionalities </li></ul><ul><li>Many clients access specialized server </li></ul><ul><li>Client machine provide interfaces </li></ul><ul><li>Utilizes processing power of the clients </li></ul>
  43. 43. Client/Server Architecture for DBMSs
  44. 44. Two-Tier Architecture <ul><li>Relational DataBase Management Systems ( RDBMS ) </li></ul><ul><li>Query Server / Transaction Server / SQL Server </li></ul><ul><li>Open DataBase Connectivity ( ODBC ) </li></ul><ul><li>Application Program Interface ( API ) </li></ul><ul><li>Client/server approach in OO-DBMS : Data Server </li></ul>
  45. 45. Three-Tier Architecture <ul><li>User interface </li></ul><ul><li>Application rules </li></ul><ul><ul><li>Middle tier </li></ul></ul><ul><ul><li>Application server/Web server </li></ul></ul><ul><li>Data access </li></ul>
  46. 46. DBMS Classifications
  47. 47. DBMS Classification Based on Data Model <ul><li>Relational data model </li></ul><ul><li>Object data model </li></ul><ul><li>Object-relational data model </li></ul><ul><li>Extended-relational model </li></ul><ul><li>XML Model </li></ul><ul><li>Hierarchical data model </li></ul><ul><li>Network data model </li></ul>
  48. 48. DBMS Classification Based on Number of Users <ul><li>Single-user systems </li></ul><ul><li>Multi-user systems </li></ul>
  49. 49. DBMS Classification Based on Number of Sites <ul><li>Centralized systems </li></ul><ul><li>Distributed DBMSs (DDBMS) </li></ul><ul><ul><li>Homogeneous DDBMS </li></ul></ul><ul><ul><li>Heterogeneous DBMS (Federated DBMS/multi-database systems) </li></ul></ul>
  50. 50. DBMS Classification – More Criteria <ul><li>Cost </li></ul><ul><li>Type of access path </li></ul><ul><li>Purpose </li></ul><ul><ul><li>General purpose </li></ul></ul><ul><ul><li>Special purpose </li></ul></ul><ul><ul><ul><li>E.g. Airline system (OLTP – Online transaction processing systems) </li></ul></ul></ul>
  51. 51. Summary <ul><li>Data Models </li></ul><ul><li>Database Schemas </li></ul><ul><li>DB Languages </li></ul><ul><li>DBMS Interfaces </li></ul><ul><li>DB System Environment </li></ul><ul><li>DBMS Architectures </li></ul><ul><li>DBMS Classifications </li></ul>
  52. 52. Questions? Thank you!