Object-relational database systems

57
Object-relational database systems Yong Yao CS632 April 17, 2001

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 Presentation

Transcript of Object-relational database systems

Page 1: Object-relational database systems

Object-relational database systems

Yong YaoCS632

April 17, 2001

Page 2: Object-relational database systems

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

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

Taxonomy of DBMS Application

Yes

No

Use SQL

data Simple Complexcomplexity

Page 5: Object-relational database systems

Simple data

Yes

No

Use SQL

data Simple Complexcomplexity

Relational DBMS

File System

Page 6: Object-relational database systems

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

ORDBMS

Yes

No

Use SQL

data Simple Complexcomplexity

Relational DBMS

ORDBMS

File System

OODBMS

Page 8: Object-relational database systems

Features

Base type extension Inheritance Complex object

Page 9: Object-relational database systems

Inclusion of New Types in Relational Database Systems

Michael StonebrakerEECS Dept.

University of California, Berkeley

Page 10: Object-relational database systems

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

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

Operators for Boxes

Page 13: Object-relational database systems

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

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

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

Definition of New Operators

Page 17: Object-relational database systems

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

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

Example: B-tree

Conditions for operators:

Page 20: Object-relational database systems

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

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

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

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

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

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

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

The POSTGRES Next-GenerationDatabase Management System

Michael StonebrakerGreg Kemnitz

Page 28: Object-relational database systems

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

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

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

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

Design criteria

Small number of concepts As few as possible Four constructs:

Class Inheritance Type Function

Page 33: Object-relational database systems

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Performance

Better than UCB-INGRES

Page 49: Object-relational database systems

But

Compare to the Cattell system, loses by about

a factor of two.

Page 50: Object-relational database systems

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

PREDATOR DESIGN AND INPLEMENTATION

PARVEEN SESHADRI

Page 52: Object-relational database systems

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

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

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

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

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

Thank You