52
1 IS698: Database Management Min Song IS NJIT

Database Management

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Database Management

1

IS698: Database Management

Min SongIS

NJIT

Page 2: Database Management

2

Overview

Data Models, Schemas & Instances Three-Schema Architecture and Data

Independence Database Languages & Interfaces Database System Environment Centralized DB & Client/Server

Architecture DBMS Classifications

Page 3: Database Management

3

Data Models

Page 4: Database Management

4

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

Page 5: Database Management

5

Data Model: Categories (1/3) High level: from the user perspective

For end user/customer Entity, attribute, relationships E-R diagrams

Page 6: Database Management

6

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

Page 7: Database Management

7

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

Page 8: Database Management

8

Database Schemas

Page 9: Database Management

9

What is DB Schema? A description of 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

Page 10: Database Management

10

Example: University DatabaseDB Schema

A DB Instance

Schema Constructs

Page 11: Database Management

11

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)

Page 12: Database Management

12

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

Page 13: Database Management

13

Three-Schema Architecture

Page 14: Database Management

14

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

Page 15: Database Management

15

Visualization of Three-Schema Architecture

USER 1 USER 2

EXTERNAL VIEW 1 EXTERNAL VIEW 2

CONCEPTUAL SCHEMA

INTERNAL SCHEMA

Data DataData

END USER

. . . EXTERNAL LEVEL

CONCEPTUAL LEVEL

INTERNAL LEVEL

Conceptual/internal mapping

External/conceptual mapping

STORED DATABASE

Page 16: Database Management

16

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

Page 17: Database Management

17

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

Page 18: Database Management

18

Data Independence

Page 19: Database Management

19

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

Page 20: Database Management

20

Logical Data Independence CONCEPTUAL VIEW 1 CONCEPTUAL VIEW 1

EXTERNAL VIEW

Page 21: Database Management

21

Database Languages

Page 22: Database Management

22

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

Page 23: Database Management

23

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

Page 24: Database Management

24

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

Page 25: Database Management

25

DBMS Interfaces

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

Page 26: Database Management

26

The Database System Environment

Page 27: Database Management

27Components of DBMS:

Page 28: Database Management

28

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

Page 29: Database Management

29

Relational System Architecture: Continue

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

Page 30: Database Management

30

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

Page 31: Database Management

31

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

Page 32: Database Management

32

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!

Page 33: Database Management

33

Software Components of a DBMS

DBMS Component Modules Database System Utilities Tools Application Environments Communication Facilities

Page 34: Database Management

34

DBMS Component Modules (1/2)

COMPILED (CANNED) TRANSACTIONS

PRIVILEGED COMMANDS

APPLICATION PROGRAMS

INTERACTIVE QUERY

DML STATEMENTS

Application programmers

Casual users

DDL STATEMENTS

DBA Staff

Precompiled

Host Language Compiler

Query Compiler

System Catalog/Data Dictionary

DDL Compiler

DML Compiler

Run-time Database Processor

Stored Data ManagerConcurrency Control/

Backup/Recovery Subsystems

STORED DATABASE

execution execution

Parametric users

execution

Page 35: Database Management

35

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

Page 36: Database Management

36

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

Page 37: Database Management

37

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

Page 38: Database Management

38

Application Development Environments

E.g. PowerBuilder/JBuilder Supports

Development of database applications Database design GUI development Querying and updating

Page 39: Database Management

39

Communication Software

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

Page 40: Database Management

40

DBMS Architectures

Page 41: Database Management

41

Centralized DBMSsDisplay monitor Display monitor Display monitor

Application Programs

Tex editorsTerminal

display control

DBMS Compilers

Controller Controller Controller

Memory I/O devicesDisk

CPU

SOFTWARE

HARDWARE/FIRMWARE

...

...

...

...

...

OPERATING SYSTEM

Terminals

Page 42: Database Management

42

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

Page 43: Database Management

43

Client/Server Architecture for DBMSs

CLIENT

SERVER

CLIENT

SERVER

CLIENT

...

Site 1 Site 2 Site 3 Site n

Communication Network

Diskless client Client with disk Server Server and client

Page 44: Database Management

44

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

Memory I/O devicesDisk

...

...

Network

Page 45: Database Management

45

Three-Tier Architecture

User interface

Application rules Middle tier Application

server/Web server

Data access

GUI Web Interface

Database Management

System

Application Programs, Web

Pages

Client

Application Server or Web

Server

Database Server

Page 46: Database Management

46

DBMS Classifications

Page 47: Database Management

47

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

Page 48: Database Management

48

DBMS Classification Based on Number of Users

Single-user systems Multi-user systems

Page 49: Database Management

49

DBMS Classification Based on Number of Sites

Centralized systems Distributed DBMSs (DDBMS)

Homogeneous DDBMS Heterogeneous DBMS (Federated

DBMS/multi-database systems)

Page 50: Database Management

50

DBMS Classification – More Criteria

Cost Type of access path Purpose

General purpose Special purpose

E.g. Airline system (OLTP – Online transaction processing systems)

Page 51: Database Management

51

Summary

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

Page 52: Database Management

52

Questions?

Thank you!