Professional Documents
Culture Documents
01a - Introduction - CSC 343
01a - Introduction - CSC 343
Database Systems
Database: A very large, integrated collection of data.
Examples: databases of customers, products,...
There are huge databases out there, for satellite and
Databases and DBMSs other scientific data, digitized movies,...; up to
Data Models and Data Independence hexabytes of data (i.e., 1018 bytes)
Concurrency Control and Database Transactions A database usually models (some part of) a real-world
Structure of a DBMS enterprise.
DBMS Languages Entities (e.g., students, courses)
Relationships (e.g., Paolo is taking CS564)
A Database Management System (DBMS) is a software
package designed to store and manage databases.
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 1 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 2
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 5 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 6
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 11 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 12
Ensuring Atomicity The Log
DBMSs ensure atomicity (all-or-nothing property), The following actions are recorded in the log:
even if system crashes in the middle of a transaction. Ti writes an object: the old value and the new
Idea: Keep a log (history) of all actions carried out by value; log record must go to disk before the
the DBMS while executing a set of transactions: changed page!
Before a change is made to the database, the Ti commits/aborts: a log record indicating this
corresponding log entry is forced to a safe action.
location. (WAL protocol; OS support for this is Log records chained together by transaction id, so it’s
often inadequate.) easy to undo a specific transaction (e.g., to resolve a
After a crash, the effects of partially executed deadlock).
transactions are undone using the log. (Thanks to Log is often duplexed and archived on “stable”
WAL, if log entry wasn’t saved before the crash, storage.
corresponding change was not applied to All log related activities (and in fact, all CC-related
database!) activities such as lock/unlock, dealing with deadlocks
etc.) are handled transparently by the DBMS.
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 13 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 14
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 15 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 16
Database Languages SQL, an Interactive Language
A DBMS supports several languages and several SELECT Course, Room,
modes of use: Building
Interactive textual languages, such as SQL; FROM Rooms, Courses
Interactive commands embedded in a host WHERE Code = Room
programming language (Pascal, C, Cobol, Java, AND Floor=”Ground"
etc.)
Interactive commands embedded in ad-hoc ROOMS Code Building Floor
development languages (known as 4GL), usually DS1 Ex-OMI Ground
N3 Ex-OMI Ground
with additional features (e.g., for the production of G Science Third
forms, menus, reports, ...)
COURSES Course Room Floor
Form-oriented, non-textual user-friendly languages Networks N3 Ground
such as QBE. Systems N3 Ground
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 17 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 18
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 21 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 22
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 23 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 24
Types of DBMSs The Hierarchical Data Model
Conventional — relational, network, hierarchical,
Database consists of hierarchical record
consist of records of many different record types
structures;
structures a field may have as value a list of
(database looks like a collection of files)
records; every record has at most one parent
Object-Oriented — database consists of objects
(and possibly associated programs); database Book
schema consists of classes (which can be objects B365 War & Peace $8.99
too). parent
Borrower
Multimedia — database can store formatted data children
(i.e., records) but also text, pictures,... 38 Elm Toronto
Active databases — database includes event-
condition-action rules Borrowing
Deductive databases* — like large Prolog
programs, not available commercially Jan 28, 1994 Feb 24, 1994
©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 25 ©2005 John Mylopoulos CSC343 Introduction to Databases — University of Toronto Introduction — 26