Download presentation
Presentation is loading. Please wait.
Published byBrenda Powers Modified over 9 years ago
1
CSCD34 - Data Management Systems,- A. Vaisman1 CSC D34 - Data Management Systems Instructor: Alejandro Vaisman avaisman@cs.toronto.edu University of Toronto at Scarborough
2
CSCD34 - Data Management Systems,- A. Vaisman2 Book: Database Management Systems - Ramakrishnan- Gherke-3rd. Ed. McGraw-Hill, 2003. Other: see course’s home page at http://www.cs.toronto.edu/ avaisman/cscd34/d34.htm TA: Flavio Rizzolo Office : S-627 Midterm exam: Sat. Feb. 8th, 2-4, H216
3
CSCD34 - Data Management Systems,- A. Vaisman3 Course will cover: 1. Introduction to databases (chapter 1). 2. Database conceptual design (Entity-Relationship model) (chapter 2). 3. Database Logical design (Relational model) (chapter 3). 4. Relational Database theory (Schema refinement) (chapter 19). 5. Relational Query Languages (Relational Algebra and Calculus, SQL) (chapters 4 to 6). 6. Query processing and optimization (chapters 12 to 15). 7. Transaction management & concurrency control (chapters 16 & 17). 8. Crash recovery (chapter 18).
4
CSCD34 - Data Management Systems,- A. Vaisman4 What Is a DBMS? v A very large, integrated collection of data describing activities of organizations. v Models real-world. – Entities (e.g., students, courses) – Relationships (e.g., Madonna is taking CS564) v A Database Management System (DBMS) is a software package designed to store and manage databases.
5
CSCD34 - Data Management Systems,- A. Vaisman5 A Little Bit of History v First DBMS: Bachman at General Electric, early 60’s ( Network Data Model ). Standardized by CODASYL. v Late 60’s : IBM’s IMS (Inf. Mgmt.Sys.) ( Hierarchical Data Model ). v 1970: Edgar Codd (at IBM) proposed the Relational Data Model. Strong theoretical basis. v 1980’s -90’s: Relational model consolidated. Research on query languages and data models => logic-based languages, OO DBMSs => Object- relational data model (extend DBMSs with new data types)
6
CSCD34 - Data Management Systems,- A. Vaisman6 Why Use a DBMS? v Data independence and efficient access. v Reduced application development time. v Data integrity and security. Different users may access different data subsets. v Uniform data administration. v Concurrent access, recovery from crashes.
7
CSCD34 - Data Management Systems,- A. Vaisman7 Files vs. DBMS v Application must transfer large datasets between main memory and secondary storage (e.g., buffering, page-oriented access, 32-bit addressing, etc.) v Special code for different queries v Must protect data from inconsistency due to multiple concurrent users v Crash recovery v Security and access control
8
CSCD34 - Data Management Systems,- A. Vaisman8 Describing Data: Data Models v A data model is a collection of concepts and constructs for describing data. v A schema is a description of a particular collection of data, using the a given data model. v The relational model of data is the most widely used model today. –Main concept: relation, basically a table with rows and columns. –Every relation has a schema, which describes the columns, or fields.
9
CSCD34 - Data Management Systems,- A. Vaisman9 Describing Data: Data Models (cont.) v The data model of the DBMS hides details - Semantic Models assist in the DB design process. v Semantic Models allow an initial description of data in the “real world”. v A DBMS do not support directly all the features in a semantic model. v Most widely used: Entity-Relationship model (E/R).
10
CSCD34 - Data Management Systems,- A. Vaisman10 The Relational Model (Introduction) v Central construct: the RELATION : a set of records. v Data is described through a SCHEMA specifying the name of the relation, and name and type of each field: – Students(sid: string, name: string, login: string, age : integer, gpa:real) v Actual data: instance of the relations : a set of tuples, v.g.: {,,,...} v Integrity constraints (condition every instance must verify) can also be specified.
11
CSCD34 - Data Management Systems,- A. Vaisman11 Levels of Abstraction v Data is described at three Levels of Abstraction v Many views, single conceptual (logical) schema and physical schema. –Views describe how users see the data (data tailored to different user groups). –Conceptual schema defines logical structure. –Physical schema describes the files and indexes used. * Schemas are defined using DDL; data is modified/queried using DML. Physical Schema Conceptual Schema View 1View 2View 3
12
CSCD34 - Data Management Systems,- A. Vaisman12 Example: University Database v Conceptual schema: – Students(sid: string, name: string, login: string, age : integer, gpa:real) – Courses(cid: string, cname:string, credits:integer) – Enrolled(sid:string, cid:string, grade:string) u describes data in terms of the data model of the DBMS v Physical schema: –Relations stored as unordered files. –Index on first column of Students. v External Schema (View): – Course_info(cid:string,enrollment:integer)
13
CSCD34 - Data Management Systems,- A. Vaisman13 Data Independence v Advantage of using a DBMS: applications are (not totally) isolated from changes in the way data is structured and stored. v Logical data independence : Protection from changes in logical structure of data (if the CS is changed, views can be redefined in terms of the new relations). v Physical data independence : Protection from changes in physical structure of data. * One of the most important benefits of using a DBMS!
14
CSCD34 - Data Management Systems,- A. Vaisman14 Querying a DBMS v A DBMS provides a Query Language. v Query languages allow querying and updating a DMBS in a simple way. v Most popular DML (Data Manipulation Language) : SQL(Structured Query Language). v Queries: –List the name of student with sid=27373 –Name and age of students enrolled in CSCD34
15
CSCD34 - Data Management Systems,- A. Vaisman15 Concurrency Control v 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 working on several user programs concurrently. v Interleaving actions of different user programs can lead to inconsistency: e.g., check is cleared while account balance is being computed. v DBMS ensures such problems don’t arise: users can pretend they are using a single-user system.
16
CSCD34 - Data Management Systems,- A. Vaisman16 Transaction: An Execution of a DB Program v Key concept is transaction, which is an atomic sequence of database actions (reads/writes). v 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. –Thus, ensuring that a transaction (run alone) preserves consistency is ultimately the user’s responsibility!
17
CSCD34 - Data Management Systems,- A. Vaisman17 Ensuring Atomicity v DBMS ensures atomicity (all-or-nothing property) even if system crashes in the middle of a transaction. v Idea: Keep a log (history) of all actions carried out by the DBMS while executing a set of transactions: –Before a change is made to the database, the corresponding log entry is forced to a safe location. –After a crash, the effects of partially executed transactions are undone using the log. (the change was not applied to database but to the log itself!)
18
CSCD34 - Data Management Systems,- A. Vaisman18 Structure of a DBMS v A typical DBMS has a layered architecture. v The figure does not show the concurrency control and recovery components. v 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 These layers must consider concurrency control and recovery
19
CSCD34 - Data Management Systems,- A. Vaisman19 Structure of a DBMS (cont.) Files and Access Methods Buffer Management Disk Space Management DB Parser + Optimizer + Plan Execution Query evaluation engine Recovery Manager Transaction Manager Lock Manager Index files + data files+ system catalog Web Forms Application Front Ends SQL Interface SQL Commands
20
CSCD34 - Data Management Systems,- A. Vaisman20 Databases make these folks happy... v End users and DBMS vendors v DB application programmers v 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!
21
CSCD34 - Data Management Systems,- A. Vaisman21 Summary v DBMS used to maintain, query large datasets. v Benefits include recovery from system crashes, concurrent access, quick application development, data integrity and security. v Levels of abstraction give data independence. v A DBMS typically has a layered architecture. v DBAs hold responsible jobs and are well-paid! v DBMS R&D is one of the broadest, most exciting areas in CS.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.