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