IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National...

27
iiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore

Transcript of IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National...

Page 1: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

iiWAS2002, Bandung, Indonesia

Teaching and Learning Databases

Dr. Stéphane Bressan

National University of Singapore

Page 2: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

iiWAS2002, Bandung, Indonesia

Why Databases?

Page 3: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Persistence

How can data survive the process that created them, and be reused by other processes?

Page 4: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Persistence

Main Memory is volatile Secondary or tertiary memory is

persistent

Page 5: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

CacheMain memory

Flash memoryMagnetic Disk

Optical DiskMagnetic Tape

Primary

Secondary

Tertiary

Volatile

Persistent

Persistent

Persistence

Page 6: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Large Amounts of Data

How to manage large amounts of data?

Issues:– Cost– Addressing– Speed

Page 7: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

CacheMain memory

Flash memoryMagnetic Disk

Optical DiskMagnetic Tape SPEED

CAPACITY per DOLLAR

32 bits/64bits

Large Amounts of Data

Page 8: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Large Amounts of Data

When data is to be stored on secondary or tertiary storage, then we need to devise efficient algorithms taking into account the dominant cost of Input/Output operations (I/Os)

Such algorithms are called external algorithms (e.g. sort)

Page 9: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Homogeneous Data (The Good News!)

Collections of similar objects We can predict access patterns We can devise indexing and access

methods for efficient storage, update, and retrieval

Page 10: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

(Collections of) Structured Data

We can invent data models and design applications around the data by defining the application schema

• record(last name: Smith, first name: Michael, ss#: 67534132)

• difficult for multimedia data (text, video, sound, etc)

Page 11: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

(Collections of) Structured Data

We can invent specialised languages for data definition and manipulation (COBOL, SQL)

• CREATE TABLE employee (first_name char(32), last_name CHAR(32))

• SELECT last_name FROM employee WHERE first_name = ‘Michael’

Page 12: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Concurrent and Distributed Access How can data be shared by users and

processes that are possibly distributed over a network?

Page 13: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

A Remark on Consistent States and Transactions A Consistent State of the database is a

state which complies with the business rules as usually defined by Integrity constraints– Example: “students who have not passed

cs2102 cannot take cs3223”

Page 14: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

A Remark on Consistent States and Transactions A Transaction is a logical unit of work

carried out by a user or an application for which we wish to ensure isolation and consistency

Page 15: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Concurrent Access

Concurrency Control: ACID Isolation: Transactions can be

understood independently from each other

Consistency: If individual transactions would leave the application in a consistent state, a concurrent execution should do the same

Page 16: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Sensitive Data: Integrity

How to guarantee and maintain the integrity of the data in spite of possible application, system, or media failures?

Page 17: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Sensitive Data: Integrity

The DBMS manages the recovery after failure guaranteeing durability and atomicity of the transactions

Page 18: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Sensitive Data: Integrity

Recovery: ACID – Atomicity: all actions in a transaction

happen or none happen– Durability: effects of successful

transactions last

Page 19: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Sensitive Data: Security

How to control the Access to the data?

Page 20: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Definitions

DCL: Database Control Language. It include statements to administer access privileges and transactions properties

Page 21: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

In Summary

How to manage large amounts of persistent, homogeneous, and structured data that are shared among distributed users and processes and whose integrity must be maintained and whose security must be controlled?

Page 22: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Database Application

A database application is a collection of data and the programs that allow the manipulation of these data

A database application is usually implemented using a DataBase Management System (DBMS)

Page 23: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

Database Application: Examples

ATM banking University data managemen (Oracle) Airline reservations (Amadeus, Sabre) My address book (Microsoft Access) The e-shop around the corner (MSQL)

Page 24: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

DataBase Management System

A DBMS is a collection of software that facilitates the implementation and management of database applications

Page 25: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

DataBase Management System

Examples of Relational DBMS:– Access, Paradox, dBase, FoxPro, Clipper– SQL Server, MySQL– DB2, Oracle, Sybase, Informix

Page 26: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

File and Access Methods Manager

Buffer Manager

Concurrency ControlManager

Recovery Manager

Query Evaluation Engine

Query Optimizer

I/O Manager

Data Definition Language StatementData Manipulation Language Statements

DBMS (simplified) Architecture

Storage manager

Data Control Language Statement

Page 27: IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.

iiWAS2002, Bandung, Indonesia

Introduction to Database Systems

McGrawHill

Asian Customized Edition

ISBN 007-122664-8