object-relational database systems
DESCRIPTION
Object-relational database systems. Yong Yao CS632 April 17, 2001. Content. Introduction Michael Stonebraker: Inclusion of New Types in Relational Data Base Systems. Michael Stonebraker, Greg Kemnitz: The Postgres Next Generation Database Management System. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/1.jpg)
Object-relational database systems
Yong YaoCS632
April 17, 2001
![Page 2: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/2.jpg)
Content
Introduction Michael Stonebraker: Inclusion of New Types in
Relational Data Base Systems. Michael Stonebraker, Greg Kemnitz: The
Postgres Next Generation Database Management System.
PREDATOR System Design Document: A detailed description of internal design decisions and implementation details.
![Page 3: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/3.jpg)
Introduction
The relational model Dominant mainstream approach Work well on business data
processing But things have changed drastically,
nontraditional problems.
![Page 4: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/4.jpg)
Taxonomy of DBMS Application
Yes
No
Use SQL
data Simple Complexcomplexity
![Page 5: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/5.jpg)
Simple data
Yes
No
Use SQL
data Simple Complexcomplexity
Relational DBMS
File System
![Page 6: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/6.jpg)
OODBMS
Yes
No
Use SQL
data Simple Complexcomplexity
Relational DBMS
File System
OODBMS
•A programming language with a type system
•Persistent object
![Page 7: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/7.jpg)
ORDBMS
Yes
No
Use SQL
data Simple Complexcomplexity
Relational DBMS
ORDBMS
File System
OODBMS
![Page 8: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/8.jpg)
Features
Base type extension Inheritance Complex object
![Page 9: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/9.jpg)
Inclusion of New Types in Relational Database Systems
Michael StonebrakerEECS Dept.
University of California, Berkeley
![Page 10: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/10.jpg)
Example Represent a set of boxes in the DBMS and a simple
query- find all the boxes that overlap the unit square(0,1,0,1).
RDBMS:Create box(id=i4, x1=f8, x2=f8,y1=f8,y2=f8)
select * from boxwhere ! (box.x2<=0 or box.x1>=1 or box,y2<=0 or box.y1>=1)
Too hard to understand Too complex to optimize Too many clauses to check
![Page 11: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/11.jpg)
Example (cont’d)
Create box(id=i4,desc=box)
select *from boxwhere box.desc!!”0,1,0,1”
Box: new data type “!!”: overlap operator with two operands of data type
box, return a boolean
![Page 12: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/12.jpg)
Operators for Boxes
![Page 13: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/13.jpg)
Motivation
Needs of business data processing applicationsGeographic Information System New Types: Point, Line, Polygon; New operators: distance, intersection ; New access methods: R-trees, KDB trees;
![Page 14: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/14.jpg)
Conditions
1. The definition of user-defined data types
2. The definition of new operators for these data types
3. The implementation of new access methods for data types
4. Optimized query processing for commands containing new data types and operators
![Page 15: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/15.jpg)
Definition of New Types
Follow a registration processdefine type-name length = value,
input = file-name, output = file-name
Occupy a fixed amount of space Conversion routines
![Page 16: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/16.jpg)
Definition of New Operators
![Page 17: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/17.jpg)
Safety loophole
Problem: an ADT routine which has an error can
overwrite DBMS data structures Unclear whether such errors are due to bugs
in the user routines or in the DBMS Solutions:
Run in separate address space Build a language processor Provide two environments
![Page 18: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/18.jpg)
New access methods
Users can add new access methods to support user-defined data types
Goal: extensibility Interface:
Conditions for the operators Information on the data types of operators
Define set of operators
![Page 19: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/19.jpg)
Example: B-tree
Conditions for operators:
![Page 20: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/20.jpg)
Information on the data types of operators (B-tree)
•“<=“ is required
•Type: specific type, fixed, variable, fix-var, type1, type2
![Page 21: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/21.jpg)
New set of operators (B-tree)
F1=(value - low-key) / (high-key – low-key)
F2=(high-key – value) / (high-key – low-key)
![Page 22: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/22.jpg)
Implementing New Access Methods
A collection of procedure calls open (relation-name) close (descriptor) get-next(descriptor, OPR, value, tuple-id) insert (descriptor,tuple) delete(descriptor, tuple-id) replace(descriptor, tuple-id, new-tuple) build(descriptor,keyname,OPR)
![Page 23: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/23.jpg)
Hard problem- work with transaction management
log pages – simple, but may suffer from performance penalty
log events Event-oriented interface
REDO(T) UNDO(T) LOG(event-type, event-data)
![Page 24: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/24.jpg)
Access path selection Four pieces of information for optimization
Stups: estimate the expected number of records…where rel-name.field-name OPR value
A second selectivity factor S: …where relname-1.field-1 OPR relname-2.field-2
Feasibility of merge-sort Feasibility of hash-join
Define operator token= AE, …… Stups=1 S= min(N1.N2). merge-sort with AL, hash-join
![Page 25: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/25.jpg)
Generate query processing plan
relname-1.field-1 OPR relname-2.field-2 Merge sort Iterative substitution Hash Join
Relname.field-name OPR value any access method with field-name as a key Secondary index Sequential search
![Page 26: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/26.jpg)
Summary
How to extend an abstract data type How to define new access method Integrate new access method with
transaction management Generation of optimized query
processing plan
![Page 27: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/27.jpg)
The POSTGRES Next-GenerationDatabase Management System
Michael StonebrakerGreg Kemnitz
![Page 28: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/28.jpg)
Three kinds of services for DBMS
Traditional data management Simple data type
Object management Complex data types, e.g. bitmaps, icons,
text… Knowledge management
Store and enforce a collection of rules
![Page 29: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/29.jpg)
Example- newspaper layout
store and manipulate text and graphics, Bill customers for advertisement.
Data: customer information Object: text, pictures and icons Rules: control newspaper layout
![Page 30: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/30.jpg)
POSTGRES Data Model-Design criteria
Traditional relational DBMSs data model: a collection of named relations
Orientation toward database access from a query language Interact with database by query language-
POSTQUEL User defined functions
![Page 31: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/31.jpg)
Design criteria
Orientation toward multilingual access Two selections
One language tightly coupled to the system
Multilingual POSTGRES is programming language
neutral
![Page 32: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/32.jpg)
Design criteria
Small number of concepts As few as possible Four constructs:
Class Inheritance Type Function
![Page 33: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/33.jpg)
Data Model - Class
Class(constructed type or relation) : a named collection of instances of objects.
Instances(record or tuple) : has the same collection of attributes
create EMP(name=string, salary= float, age=int)
![Page 34: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/34.jpg)
Inherit data elements from other classescreate EMP(name=string, salary= float, age=int)
create SALESMAN(quota=float) inherits EMP
Multiple inheritance – only create objects without ambiguity
Data model - Inheritance
SALESMAN
EMP
![Page 35: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/35.jpg)
Three kinds of classes
Real class: instances are stored in the database
Derived class :view Version: store differential relative to its base
class Initially has all instances of the base class Freely updated to diverge from the base class Updates to the version do not affect the base class Updates to the base class are reflected in the version
Supported by the rule system
![Page 36: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/36.jpg)
Version Example
create version my-EMP from EMP
Two classes generated:EMP-MINUS(deleted-OID)EMP-PLUS(all-fields-in EMP, replaced-OID)
Retrieve: retrieve EMP-PLUS instead Insert: All new instances for EMP or my-EMP will
be added into EMP-PLUS; Delete: move records from EMP-PLUS to EMP-
MINUS
![Page 37: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/37.jpg)
Data model - Types
Base types: Int, float, string construct new base types.
Arrays of base types: Composite types:
Construct complex objects: attributes contain other instances as part or all of their value
![Page 38: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/38.jpg)
Composite types
Contains zero or more instances of the same classcreate EMP (… , manager=EMP, coworkers=EMP)
Set: value is a collection of instances from all classescreate EMP(… , hobbies=set){softball, skiing, skating…}
![Page 39: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/39.jpg)
Data Model - Functions
C functions Arbitrary C procedures Can not be optimized by the POSTGRES Argument: base types or composite types Inherited down the class hierarchy
overpaid(EMP) overpaid(SALESMAN)
![Page 40: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/40.jpg)
Functions
Operators Utilize index Functions with one or two operands
{ALT, ALE, AE, AGT, AGE} Allow new access methods
POSTQUEL functions Any collection of commands in the POSTQUEL
Define function high-pay returns EMP asRetrieve (EMP.all)Where EMP.salary>50000
![Page 41: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/41.jpg)
POSTQUEL Set-oriented query language Support nested queries Transitive closure Support for inheritance Support for time travel
Allow a user to run historical queryretrieve (EMP.salary)from EMP [T]where EMP.name=“Sam”
Maintain two different physical collections of records Vacuum cleaner: a daemon moves records
![Page 42: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/42.jpg)
The Rules System
Requirements: referential integrity View management Triggers Integrity constraints Protection Version control
Design a general purpose rules system
![Page 43: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/43.jpg)
Syntax of rules
ON event (TO) object WHERE on new EMP.salary where
POSTQUEL-qualification EMP.name=“Fred”THEN DO [instead] then do replacePOSTQUEL-command(s) E (salary=new.salary)
from E in EMPwhere E.name=“Joe”
Event: retrieve, replace, delete, new … Object: name of a class or class.column POSTQUEL-qualification: normal qualification POSTQUEL-commands: a set of POSTQUEL commands
![Page 44: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/44.jpg)
Forward and Backward chaining
Rules specify additional actions, and these actions may activate other rules
on new EMP.salary where on retrieve to EMP.salary whereEMP.name=“Fred” EMP.name=“Joe”then do replace then do instead retrieveE(salary=new.salary) (EMP.salary)from E in EMP where EMP.name=“Fred”where E.name=“Joe”
![Page 45: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/45.jpg)
Implementation of Rules
Record level processing Rules system is called when individual
records are accessed Place a marker on the record
Query rewrite module Perform poorly for a large number of small-
scope rules Desirable when there are a small number of
larger-scope rules
![Page 46: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/46.jpg)
When rules are activated
Immediate-same transaction Immediate-different transaction Deferred-same transaction Deferred-different transaction
Currently only implements the first option
![Page 47: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/47.jpg)
Storage System
‘ no-overwrite’ storage manager Old record remains in the database
whenever an update occurs Instantaneous crash recovery Support time travel stable main memory required
![Page 48: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/48.jpg)
Performance
Better than UCB-INGRES
![Page 49: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/49.jpg)
But
Compare to the Cattell system, loses by about
a factor of two.
![Page 50: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/50.jpg)
Comments
POSTGRES allows an application designer to trade off performance for data independence
Imports only specific user functions into its address space
![Page 51: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/51.jpg)
PREDATOR DESIGN AND INPLEMENTATION
PARVEEN SESHADRI
![Page 52: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/52.jpg)
System overview
A client-server database system Goal: Extensibility - adding the ability to
process new kinds of data Basic components
Extensible table of Enhanced Abstract Data Type (E-ADTs)
Extensible table of query processing engines(QPEs)
![Page 53: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/53.jpg)
Server Architecture
RECOVERY
CONCURRENCY
BUFFERMGMT
XACTS
RECORDS SCHEMAS
EXPRESSIONSVALUES
OTHER E-ADTs
IMA
GE
E-A
DT
BA
SIC A
DTs
RELATION E-ADT
RELATION ENGINE
OTH
ER E
NG
INESSO
CK
ET
SU
PPO
RT
TH
RE
AD
SU
PPO
RT
WEB CLIENT
TEXT CLIENT
SHORE LIBRARY
DISK STORAGE
UTILITY LAYER
![Page 54: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/54.jpg)
Enhanced Data Types
Standard ADT Specify the storage format for values Specify methods that can be invoked on values Specify how some methods can be matched
using indexes Motivation: methods can be very
expensiveData.image.sharpen().clip()
![Page 55: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/55.jpg)
Improvement
Data.image.sharpen().clip() It is unnecessary for Sharpen to compress and
write its result to disk-> Pass result directly in memory to Clip
Rewrite the expression-> Data.image.clip().sharpen()
No need to retrieve the entire image
![Page 56: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/56.jpg)
E-ADT
Expose the semantics of its methods Query optimizations are performed
using these semantics
Find more at :The Case for Enhanced Abstract Data Types.
VLDB 1997
![Page 57: Object-relational database systems](https://reader033.vdocuments.site/reader033/viewer/2022061509/56813fea550346895daae45e/html5/thumbnails/57.jpg)
Thank You