ON RULES, PROCEDURES, CACHING AND VIEWS IN DATA BASE SYSTEM by M. Stonebraker, A. Jhingran, J. Goh, and S. Potamianos UC Berkley Presented by Zhou Ji.

Slides:



Advertisements
Similar presentations
Active database concepts
Advertisements

Physical Database Design and Tuning R&G - Chapter 20 Although the whole of this life were said to be nothing but a dream and the physical world nothing.
Logical DB Design: ER to Relational Entity sets to tables. Employees ssn name lot CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER, PRIMARY.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Chapter 23 Database Security and Authorization Copyright © 2004 Pearson Education, Inc.
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
The Relational Model. Introduction Introduced by Ted Codd at IBM Research in 1970 The relational model represents data in the form of table. Main concept.
COMP 3715 Spring 05. Working with data in a DBMS Any database system must allow user to  Define data Relations Attributes Constraints  Manipulate data.
Fall 2005 ICS184/EECS116 – Notes 08 1 ICS 184/EECS116: Introduction to Data Management Lecture Note 8 SQL: Structured Query Language -- DDL.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
SPRING 2004CENG 3521 The Relational Model Chapter 3.
The SQL Query Language DML1 The SQL Query Language DML Odds and Ends.
Chapter 3 An Introduction to Relational Databases.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Fundamentals, Design, and Implementation, 9/e Chapter 7 Using SQL in Applications.
Jyh-haw Yeh Dept. of Computer Science Boise State University
SQL SQL stands for Structured Query Language SQL allows you to access a database SQL is an ANSI standard computer language SQL can execute queries against.
Database Systems More SQL Database Design -- More SQL1.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
The POSTGRES Next - Generation Database Management System Michael Stonebraker Greg Kemnitz Presented by: Nirav S. Sheth.
SQL's Data Definition Language (DDL) – View, Sequence, Index.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
Database Lecture # 1 By Ubaid Ullah.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
Context Tailoring the DBMS –To support particular applications Beyond alphanumerical data Beyond retrieve + process –To support particular hardware New.
A Query Translation Scheme for Rapid Implementation of Wrappers Presented By Preetham Swaminathan 03/22/2007 Yannis Papakonstantinou, Ashish Gupta, Hector.
BACS--485 SQL 11 BACS 485 Structured Query Language.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
1.1 CAS CS 460/660 Relational Model. 1.2 Review E/R Model: Entities, relationships, attributes Cardinalities: 1:1, 1:n, m:1, m:n Keys: superkeys, candidate.
“INTRODUCTION TO DATABASE AND SQL”. Outlines 2  Introduction To Database  Database Concepts  Database Properties  What is Database Management System.
BACS 287 Structured Query Language 1. BACS 287 Visual Basic Table Access Visual Basic provides 2 mechanisms to access data in tables: – Record-at-a-time.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 17 A First Course in Database Systems.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
1 Notes on: Clusters Index and Cluster Creation in SQL Elisa Bertino CS Department and CERIAS Purdue University.
Topics Related to Attribute Values Objectives of the Lecture : To consider sorting relations by attribute values. To consider Triggers and their use for.
CMPT 258 Database Systems The Relationship Model PartII (Chapter 3)
11-1 CHAPTER 11 Concepts for Object-Oriented Databases.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
Object storage and object interoperability
1 Chapter 2 Database Environment Pearson Education © 2009.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
SQL Triggers, Functions & Stored Procedures Programming Operations.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
Database Security Database System Implementation CSE 507 Some slides adapted from Navathe et. Al.
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
Chapter 3 An Introduction to Relational Databases.
Copyright © 2004 Pearson Education, Inc.. Chapter 24 Enhanced Data Models for Advanced Applications.
Views / Session 3/ 1 of 40 Session 3 Module 5: Implementing Views Module 6: Managing Views.
Chapter 10 SQL DDL.
“Introduction To Database and SQL”
Generalization.
“Introduction To Database and SQL”
Database Processing: David M. Kroenke’s Chapter Seven:
SQL .. An overview lecture3.
Object Databases: Logical Data Modeling
Structured Query Language (3)
Chapter 7 Using SQL in Applications
ISC321 Database Systems I Chapter 4: SQL: Data definition, Constraints, and Basic Queries and Updates Fall 2015 Dr. Abdullah Almutairi.
DATABASE Purpose of database
Presentation transcript:

ON RULES, PROCEDURES, CACHING AND VIEWS IN DATA BASE SYSTEM by M. Stonebraker, A. Jhingran, J. Goh, and S. Potamianos UC Berkley Presented by Zhou Ji

Main idea of the paper: A rule system is a fundamental concept in a next generation DBMS, and it subsumes both views and procedures as special cases. Background: POSTGRES system the second POSTGRES rule system (PRS2)

1. What is view and procedure data type? What is view? View is a virtual relation that is defined on other relations, all queries and updates to which can be mapped to commands on the underlying base relation. Example: define view TOY_EMP as retrieve (EMP name, EMP age, EMP salary) where EMP dept = toy

What is the procedure data type? Data type of a column in a relation, each of which is an unrestricted collection of query language commands. Example: EMP(name, hobbies) Hobby relations: SOFTBALL(name, position, average) JOGGING(name, mile, best-time)

Define procedure foobar for employee Joe: retrieve (SOFTBALL all) where SOFTBALL name=Joe retrieve (JOGGING all) where JOGGING name =Joe Insert a record of Joe to EMP: append to EMP (name=Joe, hobbies=foobar)

2. The form of PRS2 DEFINE RULE rule-name [AS EXCEPTION rule-name] ON event TO object [[FROM clause] WHERE clause] THEN DO [instead] action NEW and CURRENT can appear instead of a tuple variable whenever a tuple is permissible.

Example 1 define rule example_1 on replace to EMP salary where EMP name = Joe then replace EMP (salary = NEW salary) where EMP name = Sam Whenever Joes salary is changed, Sam gets the same salary. define rule example_2 on retrieve to EMP salary where EMP name = Joe then replace EMP (salary = CURRENT salary) where EMP name = Bill

Example 3 define rule example_3 on retrieve to EMP salary where EMP dept = shoe and user() = Joe then do instead retrieve (salary = null) Joe is not allowed to see the salary of employees in the shoe department. define rule example_4 on retrieve to EMP salary where EMP dept = shoe and user() = Joe then do replace CURRENT (salary = null)

Example 8 define rule example_8 on retrieve to TOY_EMP then do instead retrieve (EMP-OID = EMP-OID, EMP name, EMP age, EMP salary) where (EMP dept = toy) This specifies a view - retrieving from the view TOY_EMP is mapped to the underlying base relation EMP.

3. How does the rule system simulate view and procedure? Procedure definition in POSTGRES define [updated] procedure proc- name (type-1,, type-2) as postquel-commands Without parameters, it is a view definition define [updated] view view-name as postquel-commands

Example define [updated] view TOP_EMP as retrieve (EMP name, EMP age, EMP salary) where EMP dept = toy The system construct the following rules in addition to example_8 to simulate the view define rule TOP_EMP_d on delete to TOY_EMP then do instead delete EMP where EMP OID=CURRENT EMP_OID define rule TOP_EMP_a on append to TOY_EMP then do instead append EMP (name=NEW name, age=NEW age, salary=NEW salary, dept=toy) define rule TOP_EMP_r on replace to TOY_EMP then do instead replace EMP (name=NEW name, age=NEW age, salary=NEW salary, dept=toy) where EMP OID=CURRENT EMP_OID

Rule to support procedure data type on retrieve to rel-name column-name where rel-name OID=value then do instead execute proc-name(parameter- list) Example append to EMP (name=Sam, hobbies=foolbar(param-1,,param-n)) Simulated by append to EMP (name=Sam) define rule example_17 on retrieve to EMP hobbies where EMP OID=value then do instead execute foobar(param-1,,param- n)

One general purpose rules system supports all the following concepts. Views special semantics for updating views materialized views partial views procedures special procedures caching of procedures

4. Implementation and caching Implementation –tuple level –query rewrite caching three cases –(1) object: relation, event: no where clause –(2) object: relation-name field, event : no where clause –(3) there is a where clause

Examples Consider example_8 and incoming query retrieve (TOY_EMP salary) where TOY_EMP name=Sam Rewrite the query to retrieve (EMP salary) where EMP name=Sam and EMP dept=toy

5. Conclusions It is recommend that implementers concentrate on a single powerful rules system and then simulate all of the various concepts using the rules system. Semantics of CURRENT and NEW attributes is enforced by tuple level implementation, or removed by query rewriting.

conclusions Non-standard update semantics can be specified as additional updating rule, thereby substantially enhancing the power of views. POSTGRES procedures are merely an additional application of the rule system. Caching of rules naturally supports materialized views and cached procedures, thereby no extra mechanism are required to obtain this functionality.