Sie sind auf Seite 1von 4

Course Information

Database Management Systems


v Class web page:
http://www.d.umn.edu/~rmaclin/cs4611/
§ Syllabus
Chapter 1 § Lecture notes
§ Programming Assignments
v Methods for contact:
§ Email: rmaclin@d.umn.edu (best option)
Instructor: Rich Maclin § Office: 315 HH
rmaclin@d.umn.edu § Phone: 726-8256
v Textbook:
§ Database Management Systems, Ramakrishnan & Gehrke

Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 1 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 2

Course Objectives Course Components

v Knowledge of DBMS, both in terms of use v Two Midterms, One Final


§ Midterm 1 (175), October 14
and implementation/design § Midterm 2 (175), November 23
v Experience with SQL § Final (350), December 23, 14:00-15:55

v Increased proficiency with the programming v Programming assignments (250)


§ One query (SQL) assignment
language C++ § One JDBC applet assignment
v Experience working as part of team § Three or four assignments to build a simple DB (as a team of
three)
v Experience with analysis and design of (DB) v Five Homeworks (50)
software v Grade based on percentage (90% for A-, 80% B -, etc)
§ Minimum Effort Requirement

Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 3 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 4

What Is a DBMS? Files vs. DBMS

v Application must stage large datasets


between main memory and secondary
v A very large, integrated collection of data. storage (e.g., buffering, page-oriented access,
v Models real-world enterprise. 32-bit addressing, etc.)
§ Entities (e.g., students, courses) v Special code for different queries
§ Relationships (e.g., Madonna is taking CS564) v Must protect data from inconsistency due to
v A Database Management System (DBMS) is a multiple concurrent users
software package designed to store and v Crash recovery
manage databases. v Security and access control

Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 5 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 6
?
Why Use a DBMS? Why Study Databases??

v Shift from computation to information


v Data independence and efficient access. § at the “low end”: scramble to webspace (a mess!)
§ at the “high end”: scientific applications
v Reduced application development time.
v Datasets increasing in diversity and volume.
v Data integrity and security.
§ Digital libraries, interactive video, Human
v Uniform data administration. Genome project, EOS project
v Concurrent access, recovery from crashes. § ... need for DBMS exploding
v DBMS encompasses most of CS
§ OS, languages, theory, “A”I, multimedia, logic

Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 7 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 8

Data Models Levels of Abstraction


v A data model is a collection of concepts for v Many views, single View 1 View 2 View 3
describing data. conceptual (logical) schema
v A schema is a description of a particular and physical schema.
Conceptual Schema
collection of data, using the a given data § Views describe how users
see the data.
model. § Conceptual schema defines
Physical Schema
v The relational model of data is the most widely logical structure
Physical schema describes
used model today. §
the files and indexes used.
§ Main concept: relation, basically a table with rows
and columns.
§ Every relation has a schema, which describes the * Schemas are defined using DDL; data is modified/queried using DML.
columns, or fields.
Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 9 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 10

Example: University Database Data Independence *


v Conceptual schema:
v Applications insulated from how data is
§ Students(sid: string, name: string, login: string,
structured and stored.
age: integer, gpa:real)
§ Courses(cid: string, cname:string , credits:integer)
v Logical data independence: Protection from
§ Enrolled(sid:string , cid:string , grade:string ) changes in logical structure of data.
v Physical schema: v Physical data independence: Protection from
§ Relations stored as unordered files.
changes in physical structure of data.
§ Index on first column of Students.
v External Schema (View): * One of the most important benefits of using a DBMS!
§ Course_info(cid:string,enrollment:integer)
Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 11 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 12
Concurrency Control Transaction: An Execution of a DB Program
v Key concept is transaction, which is an atomic
v Concurrent execution of user programs sequence of database actions (reads/writes).
is essential for good DBMS performance.
v Each transaction, executed completely, must
§ Because disk accesses are frequent, and relatively
slow, it is important to keep the cpu humming by
leave the DB in a consistent state if DB is
working on several user programs concurrently. consistent when the transaction begins.
§ Users can specify some simple integrity constraints on
v Interleaving actions of different user programs
the data, and the DBMS will enforce these constraints.
can lead to inconsistency: e.g., check is cleared
§ Beyond this, the DBMS does not really understand the
while account balance is being computed. semantics of the data. (e.g., it does not understand
v DBMS ensures such problems don’t arise: users how the interest on a bank account is computed).
can pretend they are using a single-user system. § Thus, ensuring that a transaction (run alone) preserves
consistency is ultimately the user’s responsibility!
Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 13 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 14

Scheduling Concurrent Transactions Ensuring Atomicity


v DBMS ensures that execution of {T1, ... , Tn} is v DBMS ensures atomicity (all-or-nothing property)
equivalent to some serial execution T1’ ... Tn’. even if system crashes in the middle of a Xact.
§ Before reading/writing an object, a transaction requests
a lock on the object, and waits till the DBMS gives it the
v Idea: Keep a log (history) of all actions carried out
lock. All locks are released at the end of the transaction. by the DBMS while executing a set of Xacts:
(Strict 2PL locking protocol.) § Before a change is made to the database, the
§ Idea: If an action of Ti (say, writing X) affects Tj (which corresponding log entry is forced to a safe location.
perhaps reads X), one of them, say Ti, will obtain the (WAL protocol; OS support for this is often inadequate.)
lock on X first and Tj is forced to wait until Ti completes; § After a crash, the effects of partially executed
this effectively orders the transactions. transactions are undone using the log. (Thanks to WAL, if
§ What if Tj already has a lock on Y and Ti later requests a log entry wasn’t saved before the crash, corresponding
lock on Y? (Deadlock!) Ti or Tj is aborted and restarted! change was not applied to database!)
Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 15 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 16

The Log Databases make these folks happy ...


v The following actions are recorded in the log:
§ Ti writes an object: the old value and the new value. v End users and DBMS vendors
• Log record must go to disk before the changed page! v DB application programmers
§ Ti commits/aborts: a log record indicating this action. § E.g. smart webmasters
v Log records chained together by Xact id, so it’s easy to v Database administrator (DBA)
undo a specific Xact (e.g., to resolve a deadlock). § Designs logical /physical schemas
v Log is often duplexed and archived on “stable” storage. § Handles security and authorization
v All log related activities (and in fact, all CC related § Data availability, crash recovery
activities such as lock/unlock, dealing with deadlocks § Database tuning as needs evolve
etc.) are handled transparently by the DBMS. Must understand how a DBMS works!

Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 17 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 18
These layers
Structure of a DBMS must consider
concurrency
Summary
control and
recovery v DBMS used to maintain, query large datasets.
v A typical DBMS has a Query Optimization v Benefits include recovery from system crashes,
layered architecture. and Execution concurrent access, quick application
v The figure does not development, data integrity and security.
Relational Operators
show the concurrency
control and recovery Files and Access Methods v Levels of abstraction give data independence.
components. Buffer Management v A DBMS typically has a layered architecture.
v This is one of several v DBAs hold responsible jobs
Disk Space Management
possible architectures; and are well-paid!
each system has its own
variations. v DBMS R&D is one of the broadest,
DB
most exciting areas in CS.
Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 19 Database Management Systems 3ed, R. Ramakrishnan and J. G e h r k e 20

Das könnte Ihnen auch gefallen