CENG 352 Database Management Systems

Slides:



Advertisements
Similar presentations
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
Advertisements

1 Introduction to Database Systems CSE444 Instructor: Scott Vandenberg University of Washington Winter 2000.
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chapter 1 Instructor: Mirsad Hadzikadic.
Chapter 1 Instructor: Murali Mani Database Management Systems.
1 541: Database Systems S. Muthu Muthukrishnan. 2 Some Data Collections I Have Played With….  Wireless call detail records.  U. S. Patents.  AskJeeves.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Introduction to Database Systems Chapter 1 Instructor: Wang-Chien Lee
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Instructor: Deborah Strahman
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Introduction to Database Systems Chapter 1 Instructor: Johannes Gehrke
CENG 352 Database Management Systems
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 1 Database Systems I Introduction.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1.
1 CENG 302 Introduction to Database Management Systems Nihan Kesim Çiçekli URL:
ECE 569 Database System EngineeringFall 2004 ECE 569 Database System Engineering Fall 2004 Yanyong Zhang:
CENG 352 Database Management Systems Instructor: Nihan Kesim Çiçekli URL:
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Instructor: Ethan Jackson
CSCD34 - Data Management Systems,- A. Vaisman1 CSC D34 - Data Management Systems Instructor: Alejandro Vaisman University of Toronto.
CSC343H – Introduction to Databases
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
Introduction. 
Database Management Systems 1 Introduction to Database Systems Instructor: Xintao Wu Ramakrishnan & Gehrke.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 18.
1 CS862 - Advanced Database Systems Sang H. Son
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Xintao Wu.
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Weichao Wang.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Overview of Database Systems.
Introduction to Database Systems Fundamental Concepts Irvanizam Zamanhuri, M.Sc Computer Science Study Program Syiah Kuala University Website:
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Lecture 21 Ramakrishnan - Chapter 18.
INFS614, Dr. Brodsky, GMU1 Database Management Systems INFS 614 Instructor: Professor Alex Brodsky
Database Systems/COMP4910/Spring05/Melikyan1 Transaction Management Overview Unit 2 Chapter 16.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
ICS 321 Fall 2009 Introduction to Database Systems Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa.
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
1 What Is a DBMS?  A very large, integrated collection of data.  Models real-world enterprise.  Entities (e.g., students, courses)  Relationships (e.g.,
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Introduction to Database Systems Chapter 1 Instructor: Johannes Gehrke
ICS 321 Spring 2011 Introduction to Database Systems Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1/12/20111Lipyeow.
CpSc 8620: DBMS Design Introduction. 2 Attribution Materials and lecture notes in this course are adapted from various sources, including the authors.
Transaction Management and Recovery, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 18.
1 CS462- Database Systems Sang H. Son
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Why do you learn database?? Chapter 0.
CENG 352 Database Management Systems Nihan Kesim Çiçekli URL:
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1.
1 CENG 351 CENG 351 Introduction to Data Management and File Structures Department of Computer Engineering METU.
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Xin Zhang.
1 Database Management Systems Introduction Instructor: Oliver Schulte
CENG 553 Database Management Systems Nihan Kesim Çiçekli URL:
Introduction to Database Systems Chapter 1
Introduction to Database Systems
Instructor: Elke Rundensteiner
Database Management Systems Chapter 1
Transaction Management Overview
Introduction to Database Systems
Overview of Database Systems Chpt 1
Instructor: Murali Mani
Transaction Management Overview
Database Management Systems Chapter 1
Transaction Management Overview
Database Management Systems
Database Management Systems CSE594
Sang H. Son CS6750: Database Systems The slides for this text are organized into chapters. This lecture covers Chapter 1. Chapter 1: Introduction.
Transaction Management
Transaction Management Overview
CENG 351 Introduction to Data Management and File Structures
Database Management Systems Chapter 1
Lecture 1: Overview of CSCI 485 Notes: I presented parts of this lecture as a keynote at Educator’s Symposium of OOPSLA Shahram Ghandeharizadeh Director.
Data Independence Applications insulated from how data is structured and stored. Logical data independence: Protection from changes in logical structure.
Transaction Management Overview
Presentation transcript:

CENG 352 Database Management Systems Instructor: Nihan Kesim Çiçekli email: nihan@ceng.metu.edu.tr URL: http://www.ceng.metu.edu.tr/~nihan

CENG 352 Instructor: Nihan Kesim Çiçekli Office: A308 Email: nihan@ceng.metu.edu.tr Lecture Hours: Mon. 14:40,15:40 (BMB4); Thu. 13:40 (BMB2) Office Hours: Fri. 10:40-11:30 Course Web page: http://www.ceng.metu.edu.tr/~semra/nli/ceng352 Teaching Assistant: Semra Doğandağ (semra@ceng.metu.edu.tr) SPRING 2004S CENG 352

Text Books and References Raghu Ramakrishnan, Database Management Systems, McGraw Hill, 3rd edition, 2003 (text book). R. Elmasri, S.B. Navathe, Fundamentals of Database Systems, 4th edition, Addison-Wesley, 2004. A. Silberschatz, H.F. Korth, S. Sudarshan, Database System Concepts, McGraw Hill, 4th edition, 2002. H. Garcia-Molina, J. D. Ullman, J. Widom, Database Systems The Complete Book, Prentice Hall, 2002. SPRING 2004S CENG 352

Grading Written assignments 15% Project 20% Midterm Exam 30% Final 35% Exam Date: Midterm Exam: 2nd week of April. SPRING 2004S CENG 352

Grading Policies Policy on missed midterm: Lateness policy: no make-up exam Lateness policy: Late assignments are penalized up to 10% per day. All assignments are to be your own work. Projects in groups of two. SPRING 2004S CENG 352

Course Outline The Relational Data Model, Relational Algebra and Calculus, SQL Query Evaluation and Optimization Relational Database Design and Tuning Transaction Management, Concurrency Control and Crash Recovery Database Security and Authorization Parallel and Distributed Databases Object-Database Systems Information Retrieval and XML Data SPRING 2004S CENG 352

What is a Database Management System? A Database Management System (DBMS) is a software package designed to store and manage databases: Manages very large amounts of data. 2. Supports efficient access to very large amounts of data. 3. Supports concurrent access to very large amounts of data. Example: bank and its ATM machines. 4. Supports secure, atomic access to very large amounts of data. Contrast two people editing the same UNIX file – last to write “wins” – with the problem if two people deduct money from the same account via ATM machines at the same time – new balance is wrong whichever writes last. SPRING 2004S CENG 352

Example: Online Bookseller Data = information on books (including categories, bestsellers, etc.), customers, pending orders, order histories, trends and preferences, etc. Massive: many gigabytes at a minimum for medium-size bookseller, more if keep all order histories over all time, even more if keep images of book covers and sample pages => Far too big for memory Persistent: data outlives programs that operate on it Multi-user: many people/programs accessing same database, or even same data, simultaneously => Need careful controls SPRING 2004S CENG 352

Files vs. DBMS Application must stage large datasets between main memory and secondary storage (e.g., buffering, page-oriented access, 32-bit addressing, etc.) Special code for different queries Must protect data from inconsistency due to multiple concurrent users Crash recovery Security and access control SPRING 2004S CENG 352

What is a Relational Database? Based on the relational model (tables): acct # name balance 12345 Sally 1000.21 34567 Sue 285.48 … … … Today used in most DBMS's. SPRING 2004S CENG 352

The DBMS Marketplace Relational DBMS companies – Oracle, Sybase – are among the largest software companies in the world. IBM offers its relational DB2 system. With IMS, a nonrelational system, IBM is by some accounts the largest DBMS vendor in the world. Microsoft offers SQL-Server, plus Microsoft Access for the cheap DBMS on the desktop, answered by “lite” systems from other competitors. Relational companies also challenged by “object-oriented DB” companies. But countered with “object-relational” systems, which retain the relational core while allowing type extension as in OO systems. SPRING 2004S CENG 352

Three Aspects to Studying DBMS's 1. Modeling and design of databases. Allows exploration of issues before committing to an implementation. 2. Programming: queries and DB operations like update. SQL = “intergalactic dataspeak.” 3. DBMS implementation. SPRING 2004S CENG 352

Query Languages Employee Department Name Dept Dept Manager SQL SELECT Manager FROM Employee, Department WHERE Employee.name = "Clark Kent” AND Employee.Dept = Department.Dept Query Language Data definition language (DDL) ~ like type defs in C or Pascal Data Manipulation Language (DML) Query (SELECT) UPDATE < relation name > SET <attribute> = < new-value> WHERE <condition> SPRING 2004S CENG 352

Host Languages Host language is completely general (Turing complete) C, C++, Java, Lisp, COBOL Application prog. DBMS Calls to DB Local Vars (Memory) (Storage) Host language is completely general (Turing complete) Query language—less general "non procedural" and optimizable SPRING 2004S CENG 352

Relational Model Relational model is good for: Large amounts of data —> simple operations Navigate among small number of relations Difficult Applications for relational model: VLSI Design (CAD in general) CASE • Graphical Data SPRING 2004S CENG 352

Other Models Where number of "relations" is large, relationships are complex Object Data Model Logic Data Model OBJECT DATA MODEL 1. Complex Objects – Nested Structure (pointers or references) 2. Encapsulation, set of Methods/Access functions 3. Object Identity 4. Inheritance – Defining new classes like old classes Object model: usually find objects via explicit navigation Also query language in some systems SPRING 2004S CENG 352

Other Models • Prolog, Datalog: LOGIC (Horn Clause) DATA MODEL if A1 and A2 then B B:- A1 and A2 Functions s(5) = 6 (successor) Predicates with Arguments: sum(X,Y,Z)  X + Y = Z sum(X,0,X) means X + 0 = X (always true for all X) sum(X,s(Y),s(Z)):-sum(X,Y,Z) means X+(Y+1) = (Z+1) if X + Y = Z More powerful than relational Can Compute Transitive Closure edge(X,Y). path(X,Y) :- edge(X,Y). path(X,Z) :- path(X,Y) & edge(Y,Z). SPRING 2004S CENG 352

Data Models Hierarchical Network Relational Object Bases now Hierarchical Network Relational Choice for most new applications Object Bases Knowledge Bases SPRING 2004S CENG 352

Why Use a DBMS? Data independence and efficient access. Reduced application development time. Data integrity and security. Uniform data administration. Concurrent access, recovery from crashes. SPRING 2004S CENG 352 3

Data Independence * Applications insulated from how data is structured and stored. Logical data independence: Protection from changes in logical structure of data. Physical data independence: Protection from changes in physical structure of data. One of the most important benefits of using a DBMS! SPRING 2004S CENG 352

Levels of Abstraction Many views, single conceptual (logical) schema and physical schema. Views describe how users see the data. Conceptual schema defines logical structure Physical schema describes the files and indexes used. View 1 View 2 View 3 Conceptual Schema Physical Schema Schemas are defined using DDL; data is modified/queried using DML. SPRING 2004S CENG 352 6

Concurrency Control Concurrent execution of user programs is essential for good DBMS performance. Because disk accesses are frequent, and relatively slow, it is important to keep the cpu humming by working on several user programs concurrently. Interleaving actions of different user programs can lead to inconsistency: e.g., check is cleared while account balance is being computed. DBMS ensures such problems don’t arise: users can pretend they are using a single-user system. SPRING 2004S CENG 352

Transaction: An Execution of a DB Program Key concept is transaction, which is an atomic sequence of database actions (reads/writes). Each transaction, executed completely, must leave the DB in a consistent state if DB is consistent when the transaction begins. Users can specify some simple integrity constraints on the data, and the DBMS will enforce these constraints. Beyond this, the DBMS does not really understand the semantics of the data. (e.g., it does not understand how the interest on a bank account is computed). Thus, ensuring that a transaction (run alone) preserves consistency is ultimately the user’s responsibility! SPRING 2004S CENG 352

Scheduling Concurrent Transactions DBMS ensures that execution of {T1, ... , Tn} is equivalent to some serial execution T1’ ... Tn’. Before reading/writing an object, a transaction requests a lock on the object, and waits till the DBMS gives it the lock. All locks are released at the end of the transaction. (Strict 2PL locking protocol.) Idea: If an action of Ti (say, writing X) affects Tj (which perhaps reads X), one of them, say Ti, will obtain the lock on X first and Tj is forced to wait until Ti completes; this effectively orders the transactions. What if Tj already has a lock on Y and Ti later requests a lock on Y? (Deadlock!) Ti or Tj is aborted and restarted! SPRING 2004S CENG 352

Ensuring Atomicity DBMS ensures atomicity (all-or-nothing property) even if system crashes in the middle of a Xact. Idea: Keep a log (history) of all actions carried out by the DBMS while executing a set of Xacts: Before a change is made to the database, the corresponding log entry is forced to a safe location. (WAL protocol; OS support for this is often inadequate.) After a crash, the effects of partially executed transactions are undone using the log. (Thanks to WAL, if log entry wasn’t saved before the crash, corresponding change was not applied to database!) SPRING 2004S CENG 352

The Log The following actions are recorded in the log: Ti writes an object: The old value and the new value. Log record must go to disk before the changed page! Ti commits/aborts: A log record indicating this action. Log records chained together by Xact id, so it’s easy to undo a specific Xact (e.g., to resolve a deadlock). Log is often duplexed and archived on “stable” storage. All log related activities (and in fact, all CC related activities such as lock/unlock, dealing with deadlocks etc.) are handled transparently by the DBMS. SPRING 2004S CENG 352 20

Databases make these folks happy End users and DBMS vendors DB application programmers e.g., smart webmasters Database administrator (DBA) Designs logical /physical schemas Handles security and authorization Data availability, crash recovery Database tuning as needs evolve Must understand how a DBMS works! SPRING 2004S CENG 352 21

Files and Access Methods Structure of a DBMS These layers must consider concurrency control and recovery A typical DBMS has a layered architecture. The figure does not show the concurrency control and recovery components. This is one of several possible architectures; each system has its own variations. Query Optimization and Execution Relational Operators Files and Access Methods Buffer Management Disk Space Management DB SPRING 2004S CENG 352 22

Summary DBMS used to maintain, query large datasets. Benefits include recovery from system crashes, concurrent access, quick application development, data integrity and security. Levels of abstraction give data independence. A DBMS typically has a layered architecture. DBAs hold responsible jobs and are well-paid!  DBMS R&D is one of the broadest, most exciting areas in CS. SPRING 2004S CENG 352