Anda di halaman 1dari 52

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
2

Data Models

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


4

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
7

Database Schemas

What is DB Schema?
A description of the database (meta-data) Covers only some aspects Not changed frequently Specify when a new database defined Meta-data = DBMS Catalog
E.g. name of record type, data items, some constraints

Schema constructs: Objects in schema Schema diagram


Convention to display schema
9

Example: University Database


DB Schema

Schema Constructs

A DB Instance

10

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

Schema, Instances & DB States


Define DB schema DB_state(0) = empty state DB_state(0) populate initial state DB_state(i) is a valid 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


12

Three-Schema Architecture

13

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


14

Visualization of Three-Schema Architecture


USER 1

...
CONCEPTUAL SCHEMA

END USER

USER 2

EXTERNAL LEVEL

EXTERNAL VIEW 1

EXTERNAL VIEW 2

External/conceptual mapping CONCEPTUAL LEVEL Conceptual/internal mapping INTERNAL LEVEL

INTERNAL SCHEMA

Data

Data

Data

15

STORED DATABASE

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
16

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

17

Data Independence

18

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
19

Logical Data Independence


CONCEPTUAL VIEW 1 CONCEPTUAL VIEW 1

EXTERNAL VIEW

20

Database Languages

21

Purpose of a Database Language


DDL (Data Definition Languages)

Conceptual schema Internal schemas (when schema separation is not clear) External schema (in most DBMSs)
Internal schema External view To manipulate the populated data Separate SDL
22

SDL (Store Definition Languages) VDL (View Definition Languages) DML (Data Manipulation Languages) Modern DB All in one (E.g. SQL)

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
23

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
24

DBMS Interfaces
Menu-Based Web Interfaces Forms-Based Interfaces Graphical User Interfaces Natural Language Interfaces Interfaces for parametric Users Interfaces for DBA

25

The Database System Environment

26

Components of DBMS:

27

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
28

Relational System Architecture: Continue


Basic modules:
parser query rewrite optimizer query executor access methods buffer manager lock manager log/recovery manager
29

Relational System Architecture: Continue


Query Rewriter Optimizer

Flattens views may change query semantics (constraints, protection, etc.)


large space of equivalent relational plans pick one thats going to be "optimal" produces either an interpretable plan tree, or compiled code modules to perform relation operations like joins, sorts, aggregations, etc. calls Access Methods for operations on base and temporary relations uniform relational interface (open, get next), a la INGRES AMI, System R's RSS multiple implementations: heap, B-tree, extensible hashing
30

Executor

Access Methods

Relational System Architecture: Continue


Buffer Manager
Intelligent user-level disk cache must interact with transaction 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
31

Lock Manager

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 Rs shadowing is too slow. Use Write-Ahead Logging! (WAL) Hard to get right!
32

Software Components of a DBMS


DBMS Component Modules Database System Utilities Tools Application Environments Communication Facilities

33

DBMS Component Modules (1/2)


Application programmers DBA Staff Casual users
APPLICATION PROGRAMS Precompiled DDL STATEMENTS PRIVILEGED COMMANDS INTERACTIVE QUERY

Parametric users
Host Language Compiler

DDL Compiler

Query Compiler DML STATEMENTS COMPILED (CANNED) TRANSACTIONS

execution System Catalog/ Data Dictionary DML Compiler

execution

Run-time Database Processor

execution

Stored Data Manager

Concurrency Control/ Backup/Recovery Subsystems

34
STORED DATABASE

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
35

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


36

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

37

Application Development Environments


E.g. PowerBuilder/JBuilder Supports
Development of database applications Database design GUI development Querying and updating

38

Communication Software
Provide access for remote users DB/DC package Supports for distributed DBMSs

39

DBMS Architectures

40

Centralized DBMSs
Terminals Display monitor Display monitor

...
Tex editors

Display monitor

Application Programs

Terminal display control

...

DBMS
SOFTWARE

Compilers

...
Controller

OPERATING SYSTEM

CPU

Controller

Controller

Memory
HARDWARE/FIRMWARE

Disk

I/O devices

... ...
41

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
42

Client/Server Architecture for DBMSs


Diskless client Client with disk Server Server and client

...
SERVER SERVER CLIENT CLIENT CLIENT

Site 1

Site 2

Site 3

Site n

Communication Network

43

Two-Tier Architecture
Relational DataBase Management Systems (RDBMS) Query Server/Transaction Server/SQL Server Open DataBase Connectivity (ODBC) Application Program Interface (API)

Client/server approach in OO-DBMS: Data Server


Controller Network Controller Controller

...

Memory

Disk

I/O devices

...
44

Three-Tier Architecture
User interface Application rules
Middle tier Application server/Web server
Application Server or Web Server Application Programs, Web Pages Client GUI Web Interface

Data access

Database Server

Database Management System


45

DBMS Classifications

46

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


47

DBMS Classification Based on Number of Users


Single-user systems Multi-user systems

48

DBMS Classification Based on Number of Sites


Centralized systems Distributed DBMSs (DDBMS)
Homogeneous DDBMS Heterogeneous DBMS (Federated DBMS/multi-database systems)

49

DBMS Classification More Criteria


Cost Type of access path Purpose
General purpose Special purpose
E.g. Airline system (OLTP Online transaction processing systems)

50

Summary
Data Models Database Schemas DB Languages DBMS Interfaces DB System Environment DBMS Architectures DBMS Classifications
51

Questions?
Thank you!

52

Anda mungkin juga menyukai