+ All Categories
Home > Documents > Principles of Database Management Systems

Principles of Database Management Systems

Date post: 04-Jan-2016
Category:
Upload: lotta
View: 130 times
Download: 0 times
Share this document with a friend
Description:
Principles of Database Management Systems. ( Tietokannanhallintajärjestelmät ) Pekka Kilpeläinen Fall 2001. Credits. Based on Stanford CS 245 lecture notes by original authors Hector Garcia-Molina, Jeff Ullman and Jennifer Widom - PowerPoint PPT Presentation
30
DBMS 2001 Notes 1: Introduction 1 Principles of Database Management Systems (Tietokannanhallintajärjestelmät ) Pekka Kilpeläinen Fall 2001
Transcript
Page 1: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 1

Principles of Database Management Systems

(Tietokannanhallintajärjestelmät)

Pekka KilpeläinenFall 2001

Page 2: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 2

Credits

• Based on Stanford CS 245 lecture notes by original authors Hector Garcia-Molina, Jeff Ullman and Jennifer Widom

• Responsibility of any errors due to modifications belongs to Pekka Kilpeläinen

Page 3: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 3

Isn’t Implementing a Database System Simple?

Relations Statements Results

Page 4: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 4

Introducing the

Database Management System

• The latest from Megatron Labs• Incorporates latest relational technology• UNIX/Linux compatible

Page 5: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 5

Megatron 3000 Implementation Details

First sign non-disclosure agreement

Page 6: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 6

Megatron 3000 Implementation Details

• Relations stored in files (ASCII)e.g., relation R(A,B,C) is in /usr/db/R

Smith # 123 # CSJones # 522 # EE

.

.

.

Page 7: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 7

Megatron 3000 Implementation Details

• Schema file (ASCII) in /usr/db/schema:

R1 # A # INT # B # STR …R2 # C # STR # A # INT …...

relations/tables

domains/types

attributes/columns

Page 8: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 8

Megatron 3000Sample Sessions

% MEGATRON3000 Welcome to MEGATRON 3000!&

&

...

quit%

Page 9: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 9

Megatron 3000Sample Sessions

& select * from R ;

Relation R A B C Smith 123 CS Jones 522 EE ...&

columns/attributes

rows/tuples

Page 10: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 10

Megatron 3000Sample Sessions

& select A,B from R,S where R.B = S.B and S.C > 100;

A B Smith 123 Jones 522

&

Page 11: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 11

Megatron 3000Sample Sessions

& select * from R | LPR ;&

Result sent to LPR (printer).

Page 12: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 12

Megatron 3000Sample Sessions

& select * from R where R.A < 100 | T ;&

New relation T created.

Page 13: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 13

Megatron 3000

• To execute “select * from R where condition”:

(1) Read dictionary to get attributes of R(2) Check validity of condition(3) Display attributes of R as the header(4) Read file R; for each line:

(a) Check condition(b) If TRUE, display

Page 14: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 14

Megatron 3000

• To execute “select * from R where condition | T”:

(1) Process select as before(2) Write results to new file T(3) Append new line to

usr/db/schema

Page 15: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 15

Megatron 3000

• To execute “select A,B from R,S where condition”:

(1) Read dictionary to get attributes of R and S

(2) Read file R: for each line r:(a) Read file S: for each line s:

(i) Create join tuple r&s(ii) Check condition(iii) If TRUE, display r&s[A,B]

Page 16: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 16

What’s wrong with the Megatron 3000 DBMS?

• No GUI

Page 17: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 17

What’s wrong with the Megatron 3000 DBMS?

• Tuple layout on diskE.g., - Change a string from ‘Cat’ to

‘Cats’ and we have to rewrite the end of the file

- Updates are expensive- ASCII storage is expensive; E.g., MAXINT = 231-1=2147483647

takes 4 B; string “2147483647” takes 10 B

Page 18: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 18

What’s wrong with the Megatron 3000 DBMS?

• Search expensive; no indexese.g., - Cannot find tuples with given key

quickly- Always have to read the full

relation

Page 19: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 19

What’s wrong with the Megatron 3000 DBMS?

• Brute force query processinge.g., select *

from R,S

where R.A = S.A and S.B > 1000

- Do selection using S.B > 1000 first?

- More efficient join?

Page 20: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 20

What’s wrong with the Megatron 3000 DBMS?

• No concurrency control:– simultaneously working

processes (transactions) could cause inconsistent database state

Page 21: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 21

What’s wrong with the Megatron 3000 DBMS?

• No reliability• In case of error, say, power

failure- Can lose data- Can leave operations half done

Page 22: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 22

What’s wrong with the Megatron 3000 DBMS?

• No security– File system security is coarse– Unable to restrict access, say, to

some fields of relations

Page 23: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 23

What’s wrong with the Megatron 3000 DBMS?

• No application program interface (API)

e.g., How can a payroll program get at the data?

Page 24: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 24

Course Overview

• Physical data storageBlocks on disks, records in blocks, fields in

records

• Indexing & HashingB-Trees, hashing,…

• Query ProcessingMethods to execute SQL queries efficiently

• Crash RecoveryFailures, stable storage, logging policies, ...

Page 25: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 25

Course Overview

• Concurrency ControlCorrectness, serializability, locks,…

• Information integration– (if time permits)

Page 26: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 26

Simplified DBMS structure

Query processor

User/Application

Transaction processor

Storage manager

Buffers

Permanent storage

Indexes

User Data System Data

Page 27: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 27

Why study DBMS implementation techniques?

• Computer scientists’ core knowledge• Techniques applicable in implementing

DBMS-like systems• Understanding of DBMS internals

necessary for database administrators

• NB: This course is not about designing DB-based applications or about using some specific database systems

Page 28: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 28

Administration

• Course homepage: http://www.cs.uku.fi/~kilpelai/DBMS01/

– assignments, announcements, notes• Lecturer: [email protected]• Assistant: [email protected]

Page 29: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 29

Details• LECTURES: Oct. 29 - Dec. 17, Microteknia MT2 • TEXTBOOK: Garcia-Molina, Ullman, Widom;

"DATABASE SYSTEM IMPLEMENTATION"

• ASSIGNMENTS: Seven written homework assignments; solutions discussed in exercise sessions. No programming.

• GRADING: (32*Exam/MaxExam + 12*HomeWork/MaxHomeWork

- 8)/3

• WEB SITE: Assignments & notes will be posted on our Web site at http://www.cs.uku.fi/~kilpelai/DBMS01

• Plase check it periodically for last minute announcements.

Page 30: Principles of Database Management Systems

DBMS 2001 Notes 1: Introduction 30

Reading assignment

• Refresh your memory about basics of the relational model and SQL– from your earlier course notes– from some textbook– E.g. Garcia-Molina, Ullman & Widom,

pp. 14-20


Recommended