CPS 216: Advanced Database Systems: Shivnath Babu
CPS 216: Advanced Database Systems: Shivnath Babu
Shivnath Babu
Data Management
User/Application
Query
Query
Query
Data
Example: At a Company
Query 1: Is there an employee named Nemo? Query 2: What is Nemos salary? Query 3: How many departments are there in the company? Query 4: What is the name of Nemos department? Query 5: How many employees are there in the Accounts department? Employee
ID
10 20 40 52
Department
DeptID
12 156 89 34
Name
Nemo Dory Gill Ray
Salary
120K 79K 76K 85K
ID
12 34 89 156
Name
IT Accounts HR Marketing
Answer Translates Q into best execution plan for current conditions, runs plan
DBMS
Data
Cars
Make Honda Model Accord OwnerID 12
Owners
ID 12 Name Nemo Age 22
Toyota
Mini Honda
Camry
Cooper Accord
34
89 156
34
89 156
Ray
Gill Dory
42
36 21
Answer Translates Q into best execution plan for current conditions, runs plan
DBMS
Keeps data safe and correct despite failures, concurrent updates, online processing, etc.
Data
DBMS is multi-user
Example
Get account balance from database; If balance > amount of withdrawal then balance = balance - amount of withdrawal; dispense cash; store new balance into database;
Homer at ATM1 withdraws $100 Marge at ATM2 withdraws $50 Initial balance = $400, final balance = ? Should be $250 no matter who goes first
if balance > amount then balance = balance - amount; $300 write balance; $300
if balance > amount then balance = balance - amount; $350 write balance; $350
Recovery in DBMS
Example: balance transfer decrement the balance of account X by $100; increment the balance of account Y by $100;
Scenario 1: Power goes out after the first instruction Scenario 2: DBMS buffers and updates data in memory (for efficiency); before they are written back to disk, power goes out Log updates; undo/redo during recovery
Answer Translates Q into best execution plan for current conditions, runs plan
DBMS
Keeps data safe and correct despite failures, concurrent updates, online processing, etc.
Data
Course Outline
40% of the class is about core DBMS concepts
Query execution, query optimization, transactions, recovery, etc. Textbook material
Loader
Table R
Table S
Result
Input streams
Answer
DBMS
TeraBytes PetaBytes
Data
<CD> <TITLE>Empire B.</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia </COMPANY> <PRICE>10.90</PRICE> </CD>
Course Logistics
Reference: Database Systems: The Complete Book, by H. Garcia-Molina, J. D. Ullman, and J. Widom Web site: http://www.cs.duke.edu/courses/fall07/cps216
Grading:
Project 30% Homework Assignments 20% Midterm 20% Final 30%