Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications

About This Presentation
Title:

Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications

Description:

casual user, asking for an update, eg.: update student. set name to smith' where ssn = 345' ... storage mgr. naive. app. pgmr. casual. DBA. users. 15-415 - C. ... –

Number of Views:44
Avg rating:3.0/5.0
Slides: 69
Provided by: christosf
Learn more at: http://www.cs.cmu.edu
Category:

less

Transcript and Presenter's Notes

Title: Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications


1
Carnegie Mellon Univ.Dept. of Computer
Science15-415 - Database Applications
  • C. Faloutsos
  • Introduction

2
Outline
  • Introduction to DBMSs
  • The Entity Relationship model
  • The Relational Model
  • SQL the commercial query language
  • DB design FD, 3NF, BCNF
  • indexing, q-opt
  • concurrency control recovery
  • advanced topics (data mining, multimedia)

3
Well learn
  • What are RDBMS
  • when to use them
  • how to model data with them
  • how to store and retrieve information
  • how to search quickly for information
  • Internals of an RDBMS indexing, transactions

4
Well learn (cntd)
  • Advanced topics
  • multimedia indexing (how to find similar, eg.,
    images)
  • data mining (how to find patterns in data)

5
Detailed outline
  • Introduction
  • Motivating example
  • How do DBMSs work? DDL, DML, views.
  • Fundamental concepts
  • DBMS users
  • Overall system architecture
  • Conclusions

6
What is the goal of rel. DBMSs
  • Electronic record-keeping
  • Fast and convenient access to information.

7
Definitions
  • DBMS Data Base Management System
  • the (commercial) system, like
  • DB2, Oracle, MS SQL-server, ...
  • Database system DBMS data application
    programs

8
Motivating example
  • Eg. students, taking classes, obtaining grades
  • find my gpa
  • ltand other ad-hoc queriesgt

9
Obvious solution paper-based
  • advantages?
  • disadvantages?

eg., student folders, alpha sorted
10
Obvious solution paper-based
  • advantages?
  • cheap easy to use
  • disadvantages?

eg., student folders, alpha sorted
11
Obvious solution paper-based
  • advantages?
  • cheap easy to use
  • disadvantages?
  • no ad hoc queries
  • no sharing
  • large physical foot-print

12
Next obvious solution
  • computer-based (flat) files
  • C (Java, ...) programs to access them

e.g., one (or more) UNIX/DOS files, with student
records and their courses
13
Next obvious solution
  • your layout for the student records?

14
Next obvious solution
  • your layout for the student records?
  • (eg., comma-separated values csv
  • Smith,John,123,db,A,os,B
  • Tompson,Peter,234
  • Atkinson,Mary,345,os,B,graphics,A

15
Next obvious solution
  • your layout for the student records?
  • (many other layouts are fine, eg.
  • Smith,John,123
  • Tompson,Peter,234
  • Atkinson,Mary,345

123,db,A 123,os,B 345,os,B 345,graphics,A
16
Problems?
  • inconvenient access to data (need C
    expertize, plus knowledge of file-layout)
  • data isolation
  • data redundancy (and inconcistencies)
  • integrity problems
  • atomicity problems

17
Problems? (contd)
  • ...
  • concurrent-access anomalies
  • security problems

18
Problems? (contd)
  • why?
  • because of two main reasons
  • file-layout description is buried within the C
    programs and
  • there is no support for transactions (concurrency
    and recovery)
  • DBMSs handle exactly these two problems

19
DBMS solution
  • commercial/freeware DBMS
  • application programs

20
Main vendors/products
  • Commercial
  • Oracle
  • IBM/DB2
  • MS SQL-server
  • Sybase
  • Informix
  • (MS Access,
  • ...)

Open source Postgres (UCB) mySQL, mSQL miniBase
(Wisc) Predator (Cornell) (www.acm.org/sigmod)
21
ltLive demo with MS Accessgt
  • a simple query views
  • a join
  • an aggregate query

demo
22
Detailed outline
  • Introduction
  • Motivating example
  • How do DBMSs work? DDL, DML, views.
  • Fundamental concepts
  • DBMS users
  • Overall system architecture
  • Conclusions

23
How do DBs work?
select from student
  • Pictorially

DBMS
and meta-data catalog data dictionary
data
24
How do DBs work?
/mydb
  • isql mydb
  • sqlgtcreate table student (
  • ssn fixed
  • name char(20) )

25
How do DBs work?
  • sqlgtinsert into student values (123, Smith)
  • sqlgtselect from student

26
How do DBs work?
  • sqlgtcreate table takes (
  • ssn fixed,
  • c-id char(5),
  • grade fixed))

27
How do DBs work - contd
  • More than one tables - joins
  • Eg., roster (names only) for db

28
How do DBs work - contd
  • sqlgt select name
  • from student, takes
  • where student.ssn takes.ssn
  • and takes.c-id db

29
Views - a powerful tool!
  • what and why?
  • suppose secy is allowed to see only ssns and
    GPAs, but not individual grades
  • -gt VIEWS!

30
Views
  • sqlgt create view fellowship as (
  • select ssn, avg(grade)
  • from takes group by ssn)

31
Views
  • Views virtual tables

32
Views
  • sqlgt select from fellowship

33
Views
  • sqlgt grant select on fellowship to secy

34
Iterating advantages over (flat) files
  • logical and physical data independence, because
    data layout, security etc info stored explicitly
    on the disk
  • concurrent access and transaction support

35
Disadvantages over (flat) files?
36
Disadvantages over (flat) files
  • Price
  • additional expertise (SQL/DBA)
  • (hence over-kill for small, single-user data
    sets)

37
Detailed outline
  • Introduction
  • Motivating example
  • How do DBMSs work? DDL, DML, views.
  • Fundamental concepts
  • DBMS users
  • Overall system architecture
  • Conclusions

38
Fundamental concepts
  • 3-level architecture
  • logical data independence
  • physical data independence

39
3-level architecture
v2
v1
v3
  • view level
  • logical level
  • physical level

40
3-level architecture
  • view level
  • logical level eg., tables
  • STUDENT(ssn, name)
  • TAKES (ssn, c-id, grade)
  • physical level
  • how are these tables stored, how many bytes /
    attribute etc

41
3-level architecture
  • view level, eg
  • v1 select ssn from student
  • v2 select ssn, c-id from takes
  • logical level
  • physical level

42
3-level architecture
  • -gt hence, physical and logical data independence
  • logical D.I.
  • ???
  • physical D.I.
  • ???

43
3-level architecture
  • -gt hence, physical and logical data independence
  • logical D.I.
  • can add (drop) column add/drop table
  • physical D.I.
  • can add index change record order

44
Detailed outline
  • Introduction
  • Motivating example
  • How do DBMSs work? DDL, DML, views.
  • Fundamental concepts
  • DBMS users
  • Overall system architecture
  • Conclusions

45
Database users
  • naive users
  • casual users
  • application programmers
  • DBA (Data base administrator)

46
casual users
select from student
DBMS
and meta-data catalog
data
47
naive users
  • Pictorially

app. (eg., report generator)
DBMS
and meta-data catalog
data
48
App. programmers
  • those who write the applications (like the
    report generator)

49
DB Administrator (DBA)
  • schema definition (logical level)
  • physical schema (storage structure, access
    methods
  • schemas modifications
  • granting authorizations
  • integrity constraint specification

50
Detailed outline
  • Introduction
  • Motivating example
  • How do DBMSs work? DDL, DML, views.
  • Fundamental concepts
  • DBMS users
  • Overall system architecture
  • Conclusions

51
Overall system architecture
  • Users
  • DBMS
  • query processor
  • storage manager
  • Files

52
naive
app. pgmr
casual
DBA
users
emb. DML
DDL int.
DML proc.
app. pgm(o)
query eval.
query proc.
trans. mgr
buff. mgr
file mgr
storage mgr.
data
meta-data
53
Overall system architecture
  • query processor
  • DML compiler
  • embedded DML pre-compiler
  • DDL interpreter
  • Query evaluation engine

54
Overall system architecture (contd)
  • storage manager
  • authorization and integrity manager
  • transaction manager
  • buffer manager
  • file manager

55
Overall system architecture (contd)
  • Files
  • data files
  • data dictionary catalog ( meta-data)
  • indices
  • statistical data

56
Some examples
  • DBA doing a DDL (data definition language)
    operation, eg.,
  • create table student ...

57
naive
app. pgmr
casual
DBA
users
emb. DML
DDL int.
DML proc.
app. pgm(o)
query eval.
query proc.
trans. mgr
buff. mgr
file mgr
storage mgr.
data
meta-data
58
Some examples
  • casual user, asking for an update, eg.
  • update student
  • set name to smith
  • where ssn 345

59
naive
app. pgmr
casual
DBA
users
emb. DML
DDL int.
DML proc.
app. pgm(o)
query eval.
query proc.
trans. mgr
buff. mgr
file mgr
storage mgr.
data
meta-data
60
naive
app. pgmr
casual
DBA
users
emb. DML
DDL int.
DML proc.
app. pgm(o)
query eval.
query proc.
trans. mgr
buff. mgr
file mgr
storage mgr.
data
meta-data
61
naive
app. pgmr
casual
DBA
users
emb. DML
DDL int.
DML proc.
app. pgm(o)
query eval.
query proc.
trans. mgr
buff. mgr
file mgr
storage mgr.
data
meta-data
62
Some examples
  • app. programmer, creating a report, eg
  • main()
  • ....
  • exec sql select from student
  • ...

63
naive
app. pgmr
casual
DBA
users
pgm (src)
emb. DML
DDL int.
DML proc.
app. pgm(o)
query eval.
query proc.
trans. mgr
buff. mgr
file mgr
storage mgr.
data
meta-data
64
Some examples
  • naive user, running the previous app.

65
naive
app. pgmr
casual
DBA
users
pgm (src)
emb. DML
DDL int.
DML proc.
app. pgm(o)
query eval.
query proc.
trans. mgr
buff. mgr
file mgr
storage mgr.
data
meta-data
66
Detailed outline
  • Introduction
  • Motivating example
  • How do DBMSs work? DDL, DML, views.
  • Fundamental concepts
  • DBMS users
  • Overall system architecture
  • Conclusions

67
Conclusions
  • (relational) DBMSs electronic record keepers
  • customize them with create table commands
  • ask SQL queries to retrieve info

68
Conclusions contd
  • main advantages over (flat) files scripts
  • logical physical data independence (ie.,
    flexibility of adding new attributes, new tables
    and indices)
  • concurrency control and recovery for free
Write a Comment
User Comments (0)
About PowerShow.com