1 Introduction to Data Management Lecture #2 (Big Picture, Cont.) Instructor: Chen Li.

Slides:



Advertisements
Similar presentations
Conceptual Design using the Entity-Relationship Model
Advertisements

Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
The Entity-Relationship Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
1 541: Database Systems S. Muthu Muthukrishnan. 2 Overview of Database Design  Conceptual design: (ER Model is used at this stage.)  What are the entities.
The Entity-Relationship (ER) Model
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
The Entity-Relationship Model
Comp3300/fall021 The Entity-Relationship Model Chapter 2 What are the steps in designing a database ? Why is the ER model used to create an initial design?
The Entity-Relationship Model
The Entity-Relationship Model Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
1 The Entity-Relationship Model Chapter 2. 2 Overview of Database Design  Conceptual design: (ER Model is used at this stage.) –What are the entities.
Modeling Your Data Chapter 2. Overview of Database Design Conceptual design: –What are the entities and relationships in the enterprise? – What information.
Conceptual Design Using the Entity-Relationship (ER) Model
Lecture 2: Entity/Relationship modelling
The Entity-Relationship (ER) Model CS541 Computer Science Department Rutgers University.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
1 Chapter 2 Database Environment. 2 Objectives of Three-Level Architecture u All users should be able to access same data u User’s view immune to changes.
Compe 301 ER - Model. Today DBMS Overview Data Modeling Going from conceptual requirements of a application to a concrete data model E/R Model.
1 The Entity-Relationship Model Chapter 2. 2 Database Design Process  Requirement collection and analysis  DB requirements and functional requirements.
ISOM MIS710 Module 1a Data and Process Modeling Arijit Sengupta.
1 The Entity-Relationship Model Chapter 2. 2 Overview of Database Design  Conceptual design : (ER Model is used at this stage.)  What are the entities.
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
Introduction. 
Database Management Systems 1 Introduction to Database Systems Instructor: Xintao Wu Ramakrishnan & Gehrke.
Chapter 2 CIS Sungchul Hong
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
1 Introduction to Database Systems. 2 Database and Database System / A database is a shared collection of logically related data designed to meet the.
10/16/2015 1Yan Huang - Introduction Chapter 1: Introduction What is a DBMS? What is a DBMS? A little history of DB A little history of DB Major Components.
ICS 321 Spring 2011 High Level Database Models Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 2/7/20111Lipyeow.
Christoph F. Eick: Designing E/R Diagrams 1 The Entity-Relationship Model Chapter 3+4.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
Chapter 1 Introduction Yonsei University 1 st Semester, 2015 Sanghyun Park.
1 CS 430 Database Theory Winter 2005 Lecture 2: General Concepts.
09/03/2009Lipyeow Lim -- University of Hawaii at Manoa 1 ICS 321 Fall 2009 Introduction to Database Design Asst. Prof. Lipyeow Lim Information & Computer.
1 Conceptual Design using the Entity- Relationship Model.
The Entity-Relationship (ER) Model. Overview of db design Requirement analysis – Data to be stored – Applications to be built – Operations (most frequent)
CSC 411/511: DBMS Design 1 1 Dr. Nan WangCSC411_L2_ER Model 1 The Entity-Relationship Model (Chapter 2)
An Introduction to Database Systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 1.
1 Chapter 2 Database Environment Pearson Education © 2009.
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
Chapter 1: Introduction. 1.2 Database Management System (DBMS) DBMS contains information about a particular enterprise Collection of interrelated data.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
Topic 3: ER – Entity Relationship Model (ERM) 6/12/
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
COP Introduction to Database Structures
CS222/CS122c: Principles of Data Management Lecture #1
MODELS OF DATABASE AND DATABASE DESIGN
The Entity-Relationship Model
Modeling Your Data Chapter 2 cs542
Instructor: Elke Rundensteiner
From ER to Relational Model
Introduction to Database Systems
Chapter 2 Database Environment.
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship (ER) Model
Presentation transcript:

1 Introduction to Data Management Lecture #2 (Big Picture, Cont.) Instructor: Chen Li

2 Announcements  We added 10 more seats to the class for students on the waiting list  Deadline to drop the class: tomorrow (Friday)  Sign up on Piazza today  For general questions, use Piazza not  add “CS122A” in the subject  Form a group of 3 students by coming Tuesday  Approval needed for groups of 1 or 2 people  Discussion session switch allowed, and you need to figure out how to do it officially  Assignment 1 to be released this week (you have two weeks to do it)

3 Structure of a DBMS  A typical DBMS has a layered architecture.  The figure does not show the concurrency control and recovery components (CS 223).  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

4 DBMS Structure In More Detail Query Parser Query Optimizer Plan Executor Relational Operators (+ Utilities) Files of Records Buffer Manager Access Methods (Indices) Disk Space and I/O Manager Lock Manager Transaction Manager Log Manager Data Files Index Files Catalog Files WAL SQL Query plans API calls (CS 223) (CS 122C)

5 Components’ Roles  Query Parser  Parse and analyze SQL query  Makes sure the query is valid and talking about tables, etc., that indeed exist  Query optimizer (often w/2 steps)  Rewrite the query logically  Perform cost-based optimization  Goal is a “good” query plan considering Physical table structures Available access paths (indexes) Data statistics (if known) Cost model (for relational operations) (Cost differences can be orders of magnitude!!!) SELECT e.title, e.lastname FROM Employees e, Departments d WHERE e.dept_id = d.dept_id AND year (e.birthday >= 1970) AND d.dept_name = ‘Engineering’

6 Components’ Roles (continued)  Plan Executor + Relational Operators  Runtime side of query processing  Query plan is a tree of relational operators (drawn from the relational algebra, which you will learn all about in this class)

7 Components’ Roles (continued)  Files of Records  OSs usually have byte-stream based APIs  DBMSs instead provide record -based APIs Record = set of fields Fields are typed Records reside on pages of files  Access Methods  Index structures for lookups based on field values  We’ll look in more depth at B+ tree indexes in this class (as they are the most commonly used indexes across all commercial and open source systems)

8 Components’ Roles (continued)  Buffer Manager  The DBMS answer to main memory management!  All disk page accesses go through the buffer pool  Buffer manager caches pages from files and indices  “DB-oriented” page replacement scheme(s)  Also interacts with logging (so undo/redo possible)  Disk Space and I/O Managers  Manage space on disk (pages), including extents  Also manage I/O (sync, async, prefetch, …)  Remember: database data is persistent (!)

9 Components’ Roles (continued)  System Catalog (or “Metadata”)  Info about physical data (volumes, table spaces, …)  Info about tables (name, columns, types, … ); also, info about their constraints, keys, etc.)  Data statistics (e.g., value distributions, counts, …)  Info about indexes (types, target tables, …)  And so on! (Views, security, …)  Transaction Management  ACID (Atomicity, Consistency, Isolation, Durability)  Lock Manager for Consistency+Isolation  Log Manager for Atomicity+Durability

10 Miscellany: A Few Terms  Data Definition Language (DDL)  Used to express views + logical schemas (using a syntactic form of a data model, e.g., relational)  Data Manipulation Language (DML)  Used to access and update the data in the database (again in terms of a data model, e.g., relational)  Query Language (QL)  Synonym for DML or its retrieval (i.e., data access or query) sublanguage

11 Miscellany (Cont’d.) : Key Players  Database Administrator (DBA)  The “super user” for a database or a DBMS  Deals with things like physical DB design, tuning, performance monitoring, backup/restore, user and group authorization management  Application Developer  Builds data-centric applications (CS122b!)  Involved with logical DB design, queries, and DB application tools (e.g., JDBC, …)  Data Analyst or End User  Non-expert who uses tools to interact w/the data

12 A Brief History of Databases  Pre-relational era: 1960’s, early 1970’s  Codd’s seminal paper: 1970  Basic RDBMS R&D: (System R, Ingres)  RDBMS improvements:  Relational goes mainstream:  Distributed DBMS research:  Parallel DBMS research:  Extensible DBMS research:  OLAP and warehouse research:  Stream DB and XML DB research:  “Big Data” R&D (also including “NoSQL”): 2005-present

13 So Now What?  Time to dive into the first real topic:  Logical DB design (ER model)  Read the first two chapters of the book  Now - on to DB design…!

14 Entity–relationship (ER) model  Peter Chen (March 1976). "The Entity- Relationship Model - Toward a Unified View of Data". ACM Transactions on Database Systems 1 (1): 9–36   Peter Chen: "The entity-relationship model adopts the more natural view that the real world consists of entities and relationships. It incorporates some of the important semantic information about the real world."

15 Overview of Database Design  Conceptual design : (ER Model used at this stage.)  What are the entities and relationships in the enterprise?  What information about these entities and relationships should we store in the database?  What are the integrity constraints or business rules that hold?  A database schema in the ER Model can be represented pictorially (using an ER diagram ).  Can map an ER diagram into a relational schema (manually or using a design tool’s automation).

16 ER Model Basics  Entity: Real-world object, distinguishable from all other objects. An entity is described (in DB) using a set of attributes.  Entity Set : A collection of similar entities. E.g., all employees.  All entities in an entity set have the same set of attributes. (Until we get to ISA hierarchies… )  Each entity set has a key (a unique identifier); this can be one attribute (an “atomic” key) or several attributes (a “composite” key)  Each attribute has a domain (similar to a data type). Employees ssn name lot

17 ER Model Basics (Contd.)  Relationship : Association among two or more entities. E.g., Santa Claus works in the Toy department.  Relationship Set : Collection of similar relationships.  An n-ary relationship set R relates n entity sets E1... En; each relationship in R involves entities e1:E1,..., en:En Same entity set could participate in different relationship sets, or in different “ roles ” in same set. Reports_To lot name Employees subor- dinate super- visor ssn lot dname budget did since name Works_In DepartmentsEmployees ssn

18 Cardinality Constraints  Consider Works_In: An employee can work in many departments; a dept can have many employees.  In contrast, each dept has at most one manager, according to the cardinality constraint on Manages. Many-to-Many (M:N) 1-to-1 (1:1) 1-to Many (1:N) Many-to-1 (N:1) dname budgetdid since lot name ssn Manages Employees Departments 1N

19 Participation Constraints  Does every department have a manager?  If so, this is a participation constraint : the participation of Departments in Manages is said to be total (vs. partial ). Every Departments entity below must appear in an instance of the Manages relationship Ditto for both Employees and Departments for Works_In lot name dname budgetdid since name dname budgetdid since Manages since Departments Employees ssn Works_In 1N MN

20 ER Basics: Another Example  Let’s see if you can read/interpret the ER diagram above…! ( )  What attributes are unique (i.e., identify their associated entity instances)?  What are the rules about (the much coveted) parking passes?  What are the rules (constraints) about professors being in departments?  And, what are the rules about professors heading departments? rank name dname dno main_office In Dept Professor fac_id Head M N 1 N Assigned Parking Space pid lot_num space_num 1 1 (Note that I’m using the M:N notation, and not ‘s, here.)

21 Another Example (Cont’d.)  Unique attributes:  Professor.fac_id, Dept.dno, Parking Space.pid  Faculty parking:  1 space/faculty, one faculty/space  Some faculty can bike or walk ( )  Some parking spaces may be unused  Faculty in departments:  Faculty may have appointments in multiple departments  Departments can have multiple faculty in them  No empty departments, and no unaffiliated faculty  Department management:  One head per department (exactly)  Not all faculty are department heads NOTE: These things are all “rules of the universe” that are just being modeled here! Q: Can a faculty member head a department that he or she isn’t actually in?

22 Another Example (Cont’d.)        S1 S2 S3 P1 P2 P3 P4 D1 D2 D3    Parking Spaces Assigned (1:1) Professors In (M:N) Head (1:N) Departments