Incremental Maintenance of Views with Duplicates - CiteSeerX

21 downloads 0 Views 1MB Size Report
such views in- volve aggregate functions, which need duplicates to produce correct results. Unlike most work on the view maintenance problem that is based on ...
Incremental

Maintenance

Timothy

600 Mountain email:

Bell

Avenue, {Igrifin,

Murray

libkinl}

the

particularly volve

results.

problem

that

proach

may

of efficient contain

important

aggregate

correct

approach

when

functions, Unlike

use

present

a natural to bags

NJ 07974,

our

reasoning.

extension

to

We prove

that

materialized about

that

equivalence

that

computed.

changes

view

from

that

and more

of

efficient,

algorithm

show

than that

we prove

with aggregate functions, on views that change.

allowing

their

that

correct

often

used

to

data

that

and

subsequently

base

relations

recomputed

can

compute be

systems views.

materialized queried

are changed, to ensure

base Views

(stored against. materialized

correctness

in If

one

are

applies

views

of answers

of

the

result

had

the

to be

a reading to

of

the

practical

maintenance,

queries,

triggers

and

a rather

Bag

to queries

primitives

suggested

by

[11,

this

paper

adds

evaluation

the

nested deep

328

correct

relational

algebra,

relations results

bag basic

and

are present

on the

is

complexity

of this [20].

trying

basic algebra bag

the

24, 16]. algebras

turned bag

out

from

[11,

In 19].

essentially functions

to

continues

to hold

There

are a number

and

to

algebra.

algebra

aggregate

research

[17,

for

to

research

active

algebras

as the

basic the

also

set-theoretic In

database

basis

These

that

the

for

bags.

languages

the

accepted

we use the

to

of bag

It was also shown

since

employees

elimination

one particularly

formed 19].

and

two

duplicates

theoretical

design

[2]

be equivalent

Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association of Computing Machinery.To copy otherwise, or to republish, requires a fee and/or specific permission. SIGMOD ‘ 95, San Jose , CA USA @ 1995 ACM 0-89791-731 -6/95/0005.. $3.50

the

the projection

at least

obtained over

languages,

has been

then

(Employees).

operation.

results

between

if the

as duplicate

carry

do for

instance,

IIs.lary

from

They

computed,

eliminating

expensive

not

be

to

are

systems

important

For

when

Not

theoretical

and practical

model.

AVG

evaluation,

gap

underlying

be removed

salary.

do

database

is to

assumed

duplicates

practical

functions.

be wrong

query

has

is,

is particularly

aggregate

same

that

employees

cannot

the

topic

be

as the

of

would

up

bridge

the

must

as

maintenance

most

which

the

semantics

derived

on view set-valued,

salary

Duplicates

nicely

a database) some

views

has been

solution

constraint

are

of aggregate

average

evaluation

are

the

12, 5, 18, 26],

number

active

work

(multisets)

evaluation

of the

relations

to and

come

and

since, any

integrity

duplicates,

generally

management

to has

problem,

a large

of

be made relations

changes

relations

indicate,

However,

use bags

Introduction database

base

in

view

one often

view.

misleading

will

of the

Many In

base

[27, 4, 3, 6, 7, 14, 29,

slightly

relations

speeds 1

such

including

handle

faster

interacts

the

applicable

eliminated.

expect,

recomputing

approach

are

results

to be significantly

complete our

that

recomputing

one should

defines

implementation

Most

notion

a heuristic

must

the

finding

whole

monitors.

expressions.

than

that

to

maintenance

literature is

Instead

changes

to the

vtew

is

problems,

base

tuples

this

the

is based

a certain

only

rather

circumstances

space efficient also

view

is more

normal

from

algorithm

of

extensively name

the

expensive.

changes

that

on changes

problem

We

the

problem as the

recomputing

be very the

expression

studied

algebra

no unnecessary

is generally

propagation

We

changes

This

given

The

cor-

language.

of bag-valued

that

the

scratch

under

the change

it to

relational

basic

and preserves

ensures

Although

computing

the

propagates views.

it is correct

of minimality

of

determine

known

output

and it simplifies

as our

to view,

based

and easily

However, may

the

The

This

it produces

them. scratch

the

ap-

USA

tries

maintenance

it is robust

optimizers,

in-

to produce

approach,

constructs,

(multisets)

an algorithm

on reasoning

view.

such views

on the view

of advantages:

is

proofs.

relations

saying

against

problem

need duplicates

work

to new language

operations

the

queries

and based on equational

can be used by query

We

Hill

from

of materi-

This

on an algorithmic

has a number

rectness

maintenance

duplicates.

which

most

is based

is algebraic

extendible that

problem

that

Libkin

@research. att .com

against

views

I)uplicates

Laboratories

Abstract We study

with

Leonid

Griffin AT&T

alized

Views

of

expressive

when

power

of of

bag

languages

The

[11, 2, 19, 20, 21, 22, 31].

main

goal

for incremental algebra.

of this

maintenance

We advocate That

we

an

equation

this

primitive

applying made

view

literature.

Most

base

ad hoc the

when

is

The

been The

that

when

a similar

algorithmic

time

in

proved

as it

the harder

[12],

algebra

low-level

for

to

prove

a

of

not

clear

changes

in

difference

between

in section

7. An

how the

operation.

of

the

The

analysis

of [29],

a recursive

algorithm correctness

approach

That

This that

react

is similar

in

to be proved

that

maintenance

the

equational

out

Here

in

of

of an

problem

algorithmic

has a number

approach.

the

to

to the

of advantages

precise

semantics

quently, ier

to

using prove

algorithm. recursive variant

new

the equational correctness

Also, form

of our

to a later

approach primitives

the

change see in allows

minimality Such phase

added),

to

in

copies

of query

ours.

S and

proof

rin

one

only

view

In addition registers

attribute

which

S must

supplier

was

total

amount

of money

by not

is to define

a view

yet

paid

Unpaid

as

union

that

In

adds

[Pid

The

modified

+

then

the

that

the

derived

still

will

produce

Cost

+

subtraction

number

data

1, 200]

menus

r occurs

and

amount

it PI,

If a record

in T,

up multiplicities

particular,

record

VI.

m times

J-

n times

in

of occurrences

Oifn

of

0

Count(z,

s) = o

S)

X

multisets.

If

s is

expression

such

in T, then

that

function,

map

COUYJt(y,

database

W,

and

s to

and

the multiset

state

s,

evaluating

The

states

For

notation

Transact

2’, then

s, then

A VRi)

u AR,).

of S w.r.t. s(T)

=/j

t if

t(s)(S).

It

J- VRI)

V ARI,

L ;;:)

wAR.))

base

vS,

words,

we

transaction

is

a program

that

of

a database

in

one

step.

t. In other

we

S will

~, R~)

execute have

t in

order

to

afterwards.

is a R4

called

expression

like to determine

relations

that

propagate

a solution

to changes

for

pre(t,

S) =b (S ~ vS)

t is a

and

how t‘s changes

we seek to construct

names T

is

S),

in the

value

expressions

AS

such

that

u AS.

T in s as the on all

maintenance

the

of VS

values

s is a result

solution.

than

to

the

state

There

are

many

and

AS

produced.

331

S to

can

we

in the case of

in the old

integrity

integrity the

are equally

S)

which

S is a materialized

pre(t,

S)

has

some sure

In particular,

to evaluate in

the

been that

no

to

is

For

always

are view,

current

state

a

“good” then

it

w AS (or

Second,

conditions unnecessary

be

operation.

(S ~ vS)

executed).

“minimality”

a transaction

acceptable.

pre(t,

determine

and

transaction

of a roll-back

=

value

maintenance

before

for

AS

cheaper t

make

For

expense

and

after

impose

AS.

S

evaluate

the

the

data

if

involving

state

its

be

These

value

solutions

First,

to

us to recompute

=

be generally

are

allows

all

How

solutions? should

relation

changes

not VS

applications

allowing

the

AS

committed).

For example,

and

thus

and

(and

data. from

us to check

Clearly,

= s(S).

state

without

example,

that

this

new

aborted

names

VS

t is executed

of derived

is committed,

a &f

expressions

can be used in many

it allows

to

resulting that

the before

of S in the

should

A

that

We would

solutions

a database

T =b S means s(T)

before

Statement

S(RI,

maintenance

ions

atomic

S((RI

value

Problem

evaluate 2.2

the

evaluated

denote

relation

(Note

s, if s is defined

in S and

to

relation

state

pre(t,

pre(t,

of the

Z

denote

from

denotes

the

More

~)

T ‘~f S A (S ~ T’),

on all

in

‘~f

of S w .r. t.

and

minimal.

s is defined

s to T.)

mentioned

be

s(T)

so we consider

of applying all

T

multisets Ri.

in state

s((Ri

s we have

S)

evaluate

view

T,

a database

mentioned

evaluating

to

and

a partial

t is executed

is a pre-expression

to the

[19]. S,

the

relation

that

of S. In particular,

T))

of interdefinability

consult symbols

base

becomes

state

S)

transaction.

7’), O)

T))

S), count(x,

as S min

characterization

represent

into

can

Note

example,

ARi

(R.

Suppose

=

;

is

M AR.}.

T is a pre-expression

to check

pre(t,

q

S) – count(z,

=

and

t(s)

database

2.3

max(count(z,

=

language

“&zJ

M QRI,

s)

count(y,

{

This

(Rn

transaction

expression

every

a

is false

=

C(s))

s

Y),

COUT7t((Z,

names

are of the

we

is true

p(z)

E

s M2’) =

count(z,

+

inserted

in state

determine

=

Count(m, s ~ T)

A VRI)

as a function

s)

Count(z, ~

=

z

!JG.s,rr,l(v)=x

for

at

language,

as follows:

{

from

the

but

let

of

count(x,

couni(~,

operations,

occurrences

operation

e(S, T))

ap(s))

Count(z,

of

number

S) and

(RI

~Ri and

when

of R;

The

elimination

cartesian

for

count(~,

of count(z,

state,

such

to be considered

+

Rn

menus minimum

the

{R,

selection

duplicate

the

S)

S.

We

used,

projection

Sxs

define

count(~,

For

to any

(see

to adopt

to make

language

applicable

transactions

we prefer

in order

of a particular

readily

abstract

is easy

bag

time

transactions,

paper

of transactions,

independent

same

In this

form

s

To

for specifying

[1, 28, 30]).

results

grammar.

to languages

for example

on tuples

to we VS are

1. T7S L S =b $:

then

will

contrast

a solution

the

not

that

delete

(1)

that

may

will

meeting

strongly

relational

insist

transaction

do

condition

be called

to to

tuples

Figure

are in S.

a tuple

and

be

increase

both

[29],

the

Note

it

disjoint

weakly

conditions

mtnimai.

case

S

be called

does

from

not

AS

multiplicities

make a

of elements

in S. We

will

argue

especially

that

desirable

interact

with

aggregate

TOTAL((S =

not

acceptable.

way

functions.

or

in

strong)

which

the

a v

intended

application

a deletion

upward

in

equations

concerning

minimality

of the

Theorem

1

figure

repeated

can

propagate

upward.

Consider

the

an-

(for

an

how

the

read

to

Note

as

propa-

that

the

no assumptions

change

bags. 2 are

applications any

expression

are

a A

: when us

of Fzgure

By 2 we

tell

involves

equations

propaga-

emphasizes

an expression.

of these

in

or

equations

they

correctness

The

bag) simply

of these rules,

change

subexpressions

annotation

rewrite

changes

for

Some

(for

This

Example.

we have

equations

correct. of

number U =

the of

rules

changes

S M T.

Suppose

that + TOTAL(AS) minimal

minimal

example,

with bag).

is

changes

For example,

or strongly)

all strongly For

(weak

the

- TOTAL(VS))

a (weakly

Again,

to

A T7S) w AS)

(TOTAL(S)

assuming

minimality due

our

expressions.

insertion

gate

in

since

bag

left-to-right

(1)

that,

2 contains

in

notated

it.

while

(2)

sense

4 : We

meeting

manamal, and

=b

reinsert

A solution

delete

tion

~sminvs

2.

We only

pre(t,

solution.

solutions

The

are equally

U)

=*

changes

expressed

((S=

vS)

M AS)

69 ((T

A VT)

to S and T can be propagated

as changes

to

W AT). upward

and

U as follows:

pair

w AS)

((S -LvS)

w (( TLvT)

u AT)

P6

and AQ is a strongly

minimal

win

it for

by using

The

main

algorithm

and

solutions

efficient

than

3

However,

maintaining of

this

generating to

demonstrate

Q) =Q

solution.

goal

for

minimal

= pre(t,

view

paper

is

(at the

that

the

recomputing

to

present

time)

(at

((( SLVS)

~ AS)

;;

(((s ‘V$

~ (T ‘vT))

~;

((((s ‘VL’$)

‘b

((((s UT) L (vsmin

=E,

(U LVIU)WAIU

M AS) w AT

~(VTmin

T)) u AS) u AT

S)) L (vTmin

u AS) w AT

T))

where

problem

AS

vlU

general

more

=

u AT.

The

(VSmin

S) w (VTmin

last

is simply

step

T)

and

AIU

an application

=

of the

rules

run-time),

Preliminaries which This

ing

our

section

presents

change

propagation

agation

algorithm

sented are

in

[29],

used

to

on

equational

theory

algorithm.

the

based

For

the

for

‘(bubble

expression.

A change

relational

algebra

a collection

up”

change

example,

underlyprop-

was

sets

[29] uses the

to

the

top

applied bag

Repeated

pre-

of equations

are

one delete

that of an

a solution,

one.

However,

solution

equation

to take

AS)-

the insertion

to the

insertion

Our

first

is more

step

is

to

rules

for

bag

the

for

familiar

accustomed

expressions.

into

Let

S and propagate

– T into

complicated

obey are

AS

AS

propagation not

T’=(S-T)u(/LS-T)

a

collection

expressions.

&l laws

to using

The

expressions of with

For bag expression,

since

boolean

do

can

relational example

the

(Qmin

is not

J- T=(SLT)W(AS

immediately

following

of figure tells

into

a strongly

W

=b

A AIQ

deletions

2 guaranminimal

us that

any

minimal

(Q ~ VIQ) and

into bag.

a strongly

theorem

that VIQ)

all

one insert

rules

necessarily

a)

W =b (Q LvzQ) v~Q~Q=b4

c)

T72Q min

AZQ

one.

w AIQ. =

AIQ

V2U

to

=b

4.

from

a strongly

above,

V1 U and

minimal

Al

solution

to be

now

and

L(TLS)),

obvious.

A2U (AS

332

L

UAZQ

ApQ

to the example

(U min((~SminS)

(S WAS)

of the

b)

be transformed

taking

into

Then

Returning

that

becomes

which

=

such

they

collect

not

2 Suppose

v2Q

situation

algebra

set-valued the above

of

to

insertions

can be transformed

S – T.

define

order

all

but

(Q minVIQ).

it upward

in

and

application

tees

Theorem (Su

we

~T)

w AT

an

strongly

computationally

view

not

by Q.

maintenance

are the

does

given

compile

view

they

one

M (T LvT))

;;

M (VTminT)))

A (AS

u AT)

to be u AT)

L (U min((VSmin

S) w (VTminT)))

U by

P2.

ap(S -L ~S) =b LTP(S)J-(TP(VS) CTP(SM AS) =b &p(S) U ap(M)

P3,

~A(I$

L VI$)

=b

HA(S)

-

P4.

HA(S

~ /!h$)

=b

HA(S)

u ~A(~s)

PI.

P5,

(s~vs)~~=b(s~~)-(vsmins)

P6,

(SkJAS)MZ’ (s~vs)=7’ SL(’T-LVT)

P7. P8.

(S WAS)

P9. Plo.

Although

these

be greatly

expressions

simplified

=b(Su T)w AS =,(s-T)=vs =* (S= T) W((VTminT)=(T~S))

LZ’=b(S=T)

SL(TUAT)

Ph.

(S ~ ~S)

(S u AS)minZ’

P13.

(S A VS)

P14.

(Ski

mini”

=,

(SminT)

A (VS

=,

(SminT)

u (ASmin(T

maxT

AS)maxT

A (VSmin(S

=*

(SmaxT)

w (AS

C(S ~ VL5’) =b ~(s) c(S w AS)

P17.

(S L~S)x

P18.

(S UAS)XT=6(S

~ (~(~smins)

=b E(S) w (c(AS) T=b(Sx

they

~ (S ~ VS))

T)

W(ASXT)

equations

base

can

for

bag

expressions

relations,

tions.

to

~ T))

~ (T ~ S))

~ S)

T)&(VSx XT)

propagation

complex,

~S))

(SmaxT)

P15.

2: Change

~ (S A T))

=*

P16.

are rather

w(AS~(T=S))

=~(S4Z’)LAT

P12.

Figure

~A(vsmins)

rather

this

transformations V3U

~f

A3U

(vS

~f

L AT)

(AS

W (vT

~ vT)

A AS)

V (AT

(rule

P8 in figure

and

k be numbers

the

(vT,

assumption

AT)

This

example

was used the

Second,

by

application

simplified

subexpressions Note

there

in

solution

is derived

by

a general

2.

Third, that

oniy

is considerable

propagation

rules

replace

S~(T~VT)

the

are for

with

freedom

change

propagation

correctness,

in the 2.

design

For

example,

views.

tional

we have

point

of view.

equation

in figure

operation

e and

n =

2,

designed

if one

V’

on changed

or

V u A.

Note

2 follows its

value

of its

form.

Intuitively,

vRis

ARis,

that

ing over them

that

the

the V =

pattern.

For

any

. . . . I&),

n =

1 or

abbreviations

changes,

they

then

its

as either and are

A

corresponding

value

We

V ~ v

are

“controlled”

be computed

S-v(t,

always by

elements

from

333

this the

maintaining

more

precise

in

Algorithm

algorithm

for

to a given

view

given

two

t and

expressions

Q)) 3.

S) for

a

~Q

a &t

and

AQ

U AQ.

mutually

such

(Q L V(t, in figure

computing maintenance

a transaction

compute

Q)

add(t,

derived

three

by

repeated

minimal

be made

Q) =5 (Q L vQ)

A(t,

for

Rls, make

recursive

that

for

any

functions

transaction

t

w A(t, Q). These functions For readability, we use the S M A(t,

S) and

of these

recursive

del(t,

S) for

s).

in

figure

by iterat-

is,

define

and

our

solution

pre(t,

first Q)

will

will

6.

presents

That

A

suitable

in

are generally

relations

and

Propagation

Q, we will

that

v

S

elements

ARis

of base

let n, m T and

~ (m ~ k) times fetch

and

for

intuition

m)

we only

size

A (T J- S))

z E vT,

of z in vT,

algorithm

minimal

w(t, Q) =b are presented

same

~

of each

the

problem.

v(t,

a computa-

structure

e(R1,

for

is, could

and fetching

from

is obtained

expressions

of special and

rules

arguments

arguments

The

our

to

of section

section

We However,

T7R;s

expression such

~(T~@!’))~(S~T))

Z,

Since

This

minT)

min(n,

S.

relain the

2.

element

compute

Change

strongly

we

z occurs

of expressions

analysis

This

of the

P8 with

=b(S=T)U((S

compared form

the

results

to

T and

special

large

obtained

solutions

Thus,

each

base

is preserved

Z = ((vT

of occurrences

Then

from

4

concerned figure

Z.

small

of figure

is

all

that

minimal.

presented

rule

rules

solution

assumption

if we are

process

propagation

minimal

in VT

presented

are strongly

that

and

algorithm

theorem the

AS)

omitted).

three-step

of the

of

(vS,

(details

the

a strongly

under

solutions

recursive

First,

application

2.

could

the

section.

repeated

the

minimal

illustrates

to derive

next

then

that

are strongly

2), for

over

form

in theorem

to compute

respectively. under

by iterating

special

defined

For example,

~T7S)

than

Furthermore,

the

steps:

clauses a)

a general

applications

2, b) theorem solution,

of

2 was c) the

solution

was

functions obtained

the

propagation

rules

applied

to obtain

a strongly

results

were

further

simplified

of

Q

v(t)

Q)

R

vR,

if R +

up(s) II~(s)

~p(v(~) ll~(v(t,

SkJT

(v(~, s) - A(f, T)) W(v(f, T) LA(t,

SJ-T T

(v(t,

6(s)

e(v(t,

AR,

~P (s)

up(A(~,

H,’l(s)

II~(A(t,

SWT

(A(t,

S.J-T S min

T

S))=-

T))

S) ~A(t, S) u (A(t,

e(s)

c(A(t, S)) -LS

last

T)) L (A(t,

optimizer

at the

end.

T))

is quite

w (v(t,

T))

A- (del(t,

three

Algorithm. inputs compute

T)

one pass

.=v(t,

S)))

A

X del(t,

T))

3: Mutually

A (T L S)

min(A(t,

J S X v(t,

not

are

the

over

to

functions

easily

than

just

outlined

in the

is simply

this:

Thai

is,

the

v(t,

Q).

that

Q) could

!?. A(t,

t

from

and



A9

of A

many

the

clauses

are rather

of the

in

the

complex,

definition

we believe

subexpressions

to #. To illustrate

section

given

will

this,

recall

of that

be @ or will the example

1:

VI

=f

(Hpld,cost(sl)

V-z

‘~f

~pid,co,~(paid)

‘Sf

VI L Vz

~ HPKI,COS,(S2))

Q) to

in an actual

Unpaid

be combined where

requires

(Paid

Q.

shows

that

the

a solution that

be a strongly

=b

q5 and

u AR

in

Q) =b (Q ~ V(t,

Q)min

::

A.

some v

previ-

A(t,

the algorithm

expression

and

Q) and

Note

Thus

compute

R J- vR

.2. v(t, Q) LQ

L S)))

once

they

to

the

preserve

the

VRmin

minimal AR

view

~ for

‘b

V(t,

is

the v(t,

. — —

any

t. Let Q be a R.4 expression.

= A3 — —

Q)) ~ A(~, Q)

vl, —A1o —

4

Q) =b ~

In

334

a

transaction

~APaid. delete

bag

changes change

can

be calculated

W))

w (A(i,K)

((4 = v(t, %)) w (A(t, A(t, V2) min Unpaid II~i.,c.,~(Paid))

[kd,c.~t (A(t, min Unpaid [kd,c.,t

a similar

our

Paid

to

propagation as follows.

LV2)

((v(t, v~) ‘v(t, min Unpaid

A(t,

that

Using

Unpaid)

— — ~(t,vl

strong

transaction. =b

t

- VPaid)

functions,

functions

Then 1. pre(t,

and

simplify

y5

R +-- (R J- vR)

v

in practice a

we want

were

theorem

Let

T)

S) x T))kJ

Although

assump-

be available

rather

pre(t,

function.

problem

3

S) min(del(t,

T))

minimality. Theorem

T) v (A(t,

A(t, T)) =(v(t,

recursive

solutions

It is also why

algorithm

correctly

maintenance

A4

A7

S) x

stage,

steps

for

following

and

stage.

V(t, Q) and A(t,

ation

one recursive

The

Al

S))

S) ~ T)))

k.J((del(t,

since

would

Q, use the functions

a solution

implement

~9

T)))

S M T case.

Our

t and

S’) x A(t,

T)))U

~ (S L T))

derived

important

2 at every the

V7

A8

recursively

at a later

for

T))))

A3

T) min(del(t,

S) x A(t,

minimality

The

ous section

~ add(t,

S))

Figure

theorem

S) min(S

S) x del(t,

functions

step

query

to apply

v

T))

(A(t, T) =-v(t,

w

(( A(t, S)

of strong

only

x v(t,

minimal.

This

u (v(t,

AR is in t, and $ otherwise

N

A (T ~ S)) max(AT

(A(t,

tions

into

S) x del(t,

H~(V(t,

S) ~v(t,

((A(t,

all

T)

A2

(AS

that

min(v(t,

s))

SmaxT

assuming

strongly

(( Wt,S)

U

(R L vR)

\

by

S))))

#

if R +

(A(t,

SXT

A add(t,

T78

T))

((v(t,

R

T76

S)

x V(t,

A(t, Q)

75

S)))min Q

= (TAS))

T) min(T

S)) ~del(t,

Q

73

74

s))

T)) u (A(~, T) L A(i,

S) w (v(t,

(v(tS)

~1

t,and @ otherwise

is in

S))

L (S =T))rnax(VT

SmaxT

SXT

II~(A(t,

S) L v(~,

(vS

M AR

V2

s)) S))=

((v(t,

Smin

# (R L vR)

way

=A(~,v,)))

Vz) L d)) min Unpaid min Unpaid

Paid))

L ~Pid,Cost

(APaid)

-L k.,c.,t(vpaid)]

we can

compute

the

(v(t,

Paid))]

min Unpaid change

bag

for

insertions,

~(t,

Unpaid),

advantage

queries

that

optimizer. that

of our

can

be

WellPaid

approach

the

a view

(bPaid)]

further

Consider

we have

For

= flp,d,CO,t

[HPid,co,t(VPaid) One

to be ~ (V2 ~ VI ).

is that

it

optimized

following

WellPaid

produces

by

a

example.

defined

= HN,~~(ms~l~,YzsO,

query

Suppose

Assume

solution

(S

Sn

=

E,~(VS),

mz

=

Xl(AS).

the

OOO(Employees))

Now

if a deletion

has been

made

to Employees,

then

aggregates

we

oOO(VEmployees))

then

have

boxes,

treated

but

often

language

they

and

insertions

are specified

in some

or as queries.

For

s, Ooo(Employees),

~sa]ary
50,000 for

VWellPaid.

CTP,(aP, (S)) that

(~s.l~ry