maintenance of materialized

Upload: hien-le-tran-ngoc

Post on 03-Jun-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Maintenance of Materialized

    1/30

    US

    20070192283A1

    ( 1 9 ) United S t a t e s

    ( 1 2 ) Patent

    Application

    Publication ( 1 0 ) P u b .

    N o . :

    US 2 0 0 7 / 0 1 9 2 2 8 3 A 1

    Larson e t a l .

    ( 4 3 ) P u b .

    D a t e :

    Aug.

    1 6 ,

    2007

    ( 5 4 )

    MAINTENANCE

    OF MATERIALIZED ( 5 2 ) US. l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707/2

    OUTER-JOIN VIEWS

    ( 7 5 ) I n v e n t o r s :

    P a r - A k e

    L a r s o n ,

    R e d m o n d ,

    WA

    U S ) ;

    ( 5 7 )

    ABSTRACT

    J i n g r e n

    Z h o u , R e d m o n d , WA U S )

    M a i n t e n a n c e

    o f

    m a t e r i a l i z e d

    vieW f o r

    q u e r y o p t i m i z a t i o n

    i n

    Correspondence Address: - - -

    a d a t a b a s e .

    The

    a r c h i t e c t u r e p r o v i d e s t h e

    ? r s t p r a c t i c a l

    AMIN' TUROCY & ALVIN L LP a l g o r i t h m s f o r i n c r e m en t a l ly m a i n t a i n i n g v i e W s W i t h

    m u l

    CENTER t i p l e o u t e r j o i n s a n d a g g r e g a t e d o u t e r - j o i n v i e W s . M a t e ri a l

    CLEVELAND OH 4114

    U

    i z e d

    v i e W s

    W i t h a n y c o m b i n a t i o n

    o f

    i n n e r j o i n s ,

    o n e - s i d e d

    ( ) o u t e r j o i n s a n d

    f u l l o u t e r

    o i n s , p l u s

    a n

    o p t i o n a l a g g r e g a t i o n

    ( 7 3 )

    A s s i g n e e ' M i c r o s o f t

    C o r p o r a t i o n Redmond WA o n

    t o p c a n

    b e p r o c e s s e d b y a l g o m h m ( s )

    t h a t

    C o n s t r u c t

    incremental

    maintenance expressions based on

    converting

    ( 2 1 ) AP 1 N _ 1 1 / 3 5 4 375

    t h e

    vieW

    d e ? n i t i o n a

    j o i n - d i s j u n c t i v e

    normal

    form and

    exploiting

    database

    constraints to reduce

    maintenance

    o v e r

    - . ea . s stem com

    rises a v1eW creation

    com onent or

    (22)

    F i l e d . Feb.

    1 5 ,

    2 0 06 h d A Y P P f

    c r e a t i n g

    a m a t e r i a l i z e d vieW

    d e ? n i t i o n

    t h a t

    i n c l u d e s o u t e r

    P u b l i c a t i o n Cl a s s i ? c a t i o n

    j o i n s a

    c o n v e r s i o n

    component

    f o r c o n v e r t i n g

    a n o u t e r - j o i n

    vieW

    e x p r e s s i o n

    i n t o

    a

    normal

    f o r m ,

    and

    a

    maintenance

    ( 5 1 )

    I n t , C l , c o m p o n e n t

    f o r u p d a t i n g

    t h e s t o r e d

    m a t e r i a l i z e d

    v i e W

    r e s u l t

    G 6F 1 7 / 3 0 200601 a s s o c i a t e d W i t h t h e

    m a t e r i a l i z e d

    vieW

    d e ? n i t i o n .

    ( )

    [- 2 0 0

    f - 1 2 0 4 [ -

    1 2 0 2

    [ - 1 2 0 8

    VIEW

    COMPONENT V

    MAINTENANCE ; FOR EXPRESSIONFOR

    GRAPH

    CONSTRUCTING

    COMPUTING

    MAINTENANCE CHANGES TO NET

    1206 EXPRESSIONS V

    CONTRIBUTIONS

    OF

    { -

    FOR DIRECTLY- DIRECTLY-AFFECTED

    TARGET

    TABLE AFFECTED TERMS

    TERMS

  • 8/11/2019 Maintenance of Materialized

    2/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t

    1

    0 f

    1 3 US 2 0 0 7 / 0 1 9 2 2 8 3 A 1

    V I E W CREATION

    ,- 0 2

    COMPONENT

    CONVERSION /-

    04

    COMPONENT

    MAINTENANCE / 06

    COMPONENT

    FIG. 1

  • 8/11/2019 Maintenance of Materialized

    3/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n A u g . 1 6 , 2 0 0 7 S h e e t

    2

    0 f 1 3

    S T A R T

    7

    US 007/0192283

    A 1

    R E C EI V E UPDATETO

    TABLE

    f- 00

    V

    GET IRST

    MATERIALIZED

    VIEWV

    /-

    02

    V

    VIEW

    FOUND?

    V

    REFERENCE TABLE ?

    208

    r

    GET

    NEXTVIEWV

    A

    CONVERT POJ

    PART

    OF

    VIEW

    XPRESSION

    INTO

    NORMALFORM

    /- 10

    GENERATE VIEW

    MAINTENANCE

    EXPRESSION

    V

    EVALUATE

    VIEW

    MAINTENANCE

    EXPRESSION

    FIG. 2

  • 8/11/2019 Maintenance of Materialized

    4/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 3

    0 f

    1 3

    US

    2 0 0 7 / 0 1 9 2 2 8 3 A 1

    { 0 ,

    0 ,

    L } { 0 ,

    0 ,

    L }

    i / \

    { 0 , 0 }

    { 0 , 0 }

    { 0 ,

    L }

    i

    /

    \

    x

    \

    { C } { C } { O }

    { L }

    ( a ) V , ( b ) v 2

    FIG.

    3

    { 0 , 0 , 1 } { 0 ,

    0 ,

    L }

    { 0 : 0 } D

    { 0 1 0 } D { 0 , i , L } D

    { 6 } { 0 }

    { 0 ,

    0 }

    ( a ) M Q d i f y C ( 1 ) ) M o d i f y O

    M o d i f y

    L

    FIG.

    5

    { 0 , 0 , L } { 0 , 0 , L } D

    / \ /

    \

    { 0 ,

    0 } 0 { 0 ,

    L } *

    { 0 , 0 } { 0 , L }

    /

    \

    /

    \

    /

    \

    { 6 } { 0 } { 0 }

    { 0 } D

    { L }

    U p d a t i n g

    C

    ( b )

    U p d a t i n g 0

    FIG. 8

  • 8/11/2019 Maintenance of Materialized

    5/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 4

    0 f

    1 3 US 2 0 0 7 / 0 1 9 2 2 8 3 A 1

    RETRIEVEVIEW EFINITION /' 00

    l

    CONVERT POJ PARTOFVIEW

    402

    EXPRESSION NTO

    JOIN-

    /'

    DISIUNCTIVE NORMAL

    FORM

    1

    GENERATE

    SUBSUMPTION

    /-

    04

    GRAPHFROMNORMAL FORM

    1

    FOREACH NODE N

    THE

    RAPH,

    4 0 6

    C R E A T E

    EXPRESSION

    DEFINING

    /'

    ITS

    NET

    CONTRIBUTION

    l

    CONNECT

    ALL

    E T - 408

    CONTRIBUTION

    XPRESSIONS

    /

    BY OUTERUNIONS

    FIG. 4

  • 8/11/2019 Maintenance of Materialized

    6/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 5

    0 f

    1 3 US 2 0 0 7 / 0 1 9 2 2 8 3 A 1

    R E T R I E V E

    VIEW XPRESSION /' 00

    l

    CONVERT

    POJ PART

    OF

    VIEW 602

    EXPRESSIONTO OIN- /'

    DISJUNCTIVE

    NORMAL

    FORM

    1

    CREATE

    SUBSUMPTION GRAPH

    604

    FROMTHE

    NORMALIZED

    /'

    EXPRESSION

    l

    E LIMINATE

    FROM

    THE 6 0 6

    SUBSUMPTION GRAPHALL

    /'

    UNAFFECTEDNODES

    l

    CLASSIFY ANDMARK

    REMAININGNODESAS

    /

    08

    DI R EC T LY OR

    NDIREC TLY

    AFFECTED

    1

    DROPALL

    OUTGOING

    EDGES

    6 1 0

    FROM

    TERMSMARKED

    AS /_

    BEING INDIR ECT LY

    AFFECTED

    FIG. 6

  • 8/11/2019 Maintenance of Materialized

    7/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 6

    0 f

    1 3

    US

    2 0 0 7 / 0 1 9 2 2 8 3 A 1

    I

    S T A R T

    )

    i v

    INITIATE

    VIEW

    MAINTENANCE

    /_

    00

    V

    UPDATE

    AFFECTED

    BASE

    TABLE

    IRST / 02

    l

    CHECK

    MAINTENANCE

    GRAPH

    FOR / 04

    D I R E C T L Y - A F F E C T E D

    TERMS

    706

    N

    Y

    COMPUTE OUTERUNION OFCHANGES

    TO NET

    CONTRIBUTIONS

    OFALL

    /

    08

    DIRECTLY-AFFECTED

    TERMS

    AND

    APPLY TO VIEW

    V

    CHE CK MAINT E N ANC E G R APH FOR

    7 1 0

    INDIREC T LY-AF

    ECTED

    TERMS

    712

    N

    Y

    COMPUTE OUTER

    UNION

    F

    CHANGES

    TO NET CONTRIBUTIONSOF /- 14

    INDIR EC T LY - AF F EC T E D

    TERMS

    AND

    APPLY

    TO

    VIEW

    FIG.

    7

  • 8/11/2019 Maintenance of Materialized

    8/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 7

    0 f

    1 3 US 2 0 0 7 / 0 1 9 2 2 8 3 A 1

    { @ 0 1

    / \

    { 6 }

    { 0 }

    { 0 }

    ( a )

    U p d a t i n g

    C

    ( 1 ) ) U p d a t i n g

    0

    F I G .

    9

    ( a ) U p d a t i l l i g

    T ( 1 3 ) U p d a t i n g

    R

    FIG. 11

  • 8/11/2019 Maintenance of Materialized

    9/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 8

    0 f

    1 3

    US

    2 0 0 7 / 0 1 9 2 2 8 3 A 1

    S T A R T ,

    r

    CREATE

    MAINTENANCE

    GRAPH

    /

    000

    FORUPDATESTO TABLE

    7

    GET

    IRST

    DIRECTLY-AFFECTED /- 002

    NODE N

    1008

    r

    I GET

    NEXT

    DIRECTLY-AFFECTED

    NODEN

    A

    1 0 0 6

    f .

    1 0 0 4

    Y

    DELETE

    NODE

    N

    F ITS SOURCE

    SET CONTAINS

    A

    TABLER

    f )

    NODE

    FOUND

    JOINED

    TO TABLE THROUGH A

    FOREIGNKEYFROM

    RTO

    DELETEALL NDIRECTLY- 1010

    AFFECTED

    NODES THATHAVE /'

    NO PARENTNODES

    FIG. 10

  • 8/11/2019 Maintenance of Materialized

    10/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    A u g .

    1 6 ,

    2 0 0 7

    S h e e t 9 0 f 1 3

    [ -

    1 2 0 4 [ - 1 2 0 2

    VIEW COMPONENT

    MAINTENANCE >

    FOR

    GRAPH CONSTRUCTING

    MAINTENANCE

    1206

    EXPRESSIONS

    [ - FOR DIRECTLY

    AFFECTED

    T A RG E T

    TABLE

    TERMS

    US 007/0192283

    A 1

    {-

    2 0 0

    1208

    1 , .

    FIG. 12

    V

    EXPRESSION

    FOR

    COMPUTING

    CHANGES

    TO NET

    CONTRIBUTIONS OF

    D I R E C T L Y - A F F E C T E D

    TERMS

  • 8/11/2019 Maintenance of Materialized

    11/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 1 0

    0 f

    1 3

    US

    2 0 0 7 / 0 1 9 2 2 8 3 A 1

    1 S T A R T )

    CREATEVIEW

    MAINTENANCE /-

    300

    GRAPH

    FOR UPDATES

    TO

    TABLE

    l

    TRAVERSEGRAPHAND CREATE

    A

    MAINTENANCE

    XPRESSION A

    FOR

    DIRECTLY-AFFECTEDTERMS

    CONSISTING OF E F T OUTER OINS

    ANDINNER OINS

    l

    CREATEAMAINTENANCE

    EXPRESSION

    FOR EACH / 3 0 4

    INDIRECTLY-AFFECTEDTERMTHAT

    UTILIZES A1 ANDTHEVIEW

    /-

    302

    V

    CREATE

    AN

    ALTERNATIVE

    MAINTENANCE

    EXPRESSION

    FOR

    EACH NDIRECTLY AFFECTEDTERM

    THAT

    TILIZES A AND BASE

    TABLES

    l

    OPTIMIZER SEL ECT S

    THE

    LOWER

    COST

    XPRESSION

    OF

    THE

    TWO /- 308

    ALTERNATIVESFOREACH

    INDIRECTLYAFFECTEDTERM

    ,- 306

    FIG. 1 3

  • 8/11/2019 Maintenance of Materialized

    12/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 1 1

    0 f

    1 3 US 2 0 0 7 / 0 1 9 2 2 8 3 A 1

    I S T A R T I

    INITIATE

    MAINTENANCE

    OF / 400

    AGGREGATED

    UTER-JOIN VIEW

    7

    COMPUTE

    CHANGESTO NET

    1 4 0 2

    CONTRIBUTION

    OF /'

    DIRECTLY-AFFECTEDTERMS

    V

    COMPUTE CHANGES

    TO THE

    NET

    404

    CONTRIBUTIONOF /'

    IN DIR E CT LY - A FFE CT E D

    TERMS

    V

    AGGREGATE

    RESULTS AS SPECIFIED

    IN

    VIEW EFINITION

    AND APPLY

    TO VIEW /-

    406

    IN SAMEWAY AS FOR

    AGGREGATED

    INNER OIN VIEWS

    v

    CREATE

    NEWROWS S NEEDED

    /-

    408

    V

    DELETEANY

    ROW

    WHOSEROW COUNT

    /-

    410

    I S ZERO

    V

    I F

    NOT-NULL COUNT FOR

    A

    TABLET S

    ZERO, SET ALLAGGREGATES /- 4 1 2

    REFERENCING

    A

    COLUMN

    N

    TABLE

    TO

    NULL

    FIG. 14

  • 8/11/2019 Maintenance of Materialized

    13/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 1 2

    0 f

    1 3 US 2 0 0 7 / 0 1 9 2 2 8 3 A 1

    1500

    r

    1502

    /

    : _ _ _ ' _ _ _ _ 5.1.529--

    PROCESSING

    / - 1 5 0 4 : :

    OPERATING SYSTEM

    ;

    UNIT

    :

    T535

    ' - '

    . I

    ______ __L'_____

    1 50 8 [ - 1 5 0 6 g { A P P L I C A T I O N S :

    SYSTEM : ______ __I; 1 3 i 4 _

    MEMORY . 5 1 2 7 : M O D U L E S l

    I f1536

    > RAMk/ : .------------

    I L

    I

    ROM

    1 5 26

    FDD ,-

    1 5 1 8

    /4

    DIsK

    g

    , - 1 5 2 0

    r1544

    I

    m 1528 OPTICAL MONITOR

    ll?li I DRIVE

    / - 1 5 2 2

    / - 1 5 3 8

    f -

    1 5 4 6 DISK

    /

    KEYBOARD

    VIDEO

    1

    ADAPTOR

    ,-

    5 4 0

    F 1 5 4 2 ( w I R E D / w I R E L E s s ) M O U S E

    4

    D u g / E g g ,-155s r1554 [-1548

    INTERFACE

    MODEM < WAN * REMOTE

    COMPUTER

    r1 5 56 ,-

    1 5 5 2 (

    )

    l

    NETWORK

    LAN

    1550

    ADAPTOR

    ( W I R E D / W I R E L E S S )

    MEMORY/

    ST O R A G E

    FIG. 15

  • 8/11/2019 Maintenance of Materialized

    14/30

    P a t e n t A p p l i c a t i o n P u b l i c a t i o n

    Aug.

    1 6 ,

    2007

    S h e e t 1 3

    0 f

    1 3

    US

    2 0 0 7 / 0 1 9 2 2 8 3 A 1

    {- 1 6 0 0

    f -

    1 6 0 2 1 6 0 4

    \

    C L I E N T ( S ) S E R V E R ( S )

    COMMUNICATION

    ~

    FRAMEWORK

    1 6 0 8 1610

    \ V

    1606

    V

    CLIENT

    DATA TORE(S) SERVER D A T A STORE(S)

    FIG.

    16

  • 8/11/2019 Maintenance of Materialized

    15/30

    US

    007/0192283 A 1

    MAINTENANCE

    OF

    MATERIALIZED

    OUTER-JOIN VIEWS

    BACKGROUND

    [ 0 0 0 1 ]

    With

    h e

    a d v e n t

    o f

    t h e

    I n t e r n e t ,

    m a s s i v e

    a m o u n t s

    o f

    d a t a a r e

    becoming

    more a c c e s s i b l e t o l a r g e

    number

    of s e r s ,

    W h e t h e r i n i n t e r n a l c o r p o r a t e

    e n v i r o n m e n t s

    o r i n t h e p u b l i c

    arena such a s Web-based d a t a b a s e s . Accordingly, more f f i

    c i e n t a n d p e r f o r m a n c e - d r i v e n r e q u i r e m e n t s a r e b e i n g p l a c e d

    on u c h s y s t e m s

    a s

    t h e number of s e r , and o n s e q u e n t l y , t h e

    number

    a n d c o m p l e x i t y o f

    q u e r i e s

    c o n t i n u e s t o i n c r e a s e .

    [ 0 0 0 2 ] I n

    a r e l a t i o n a l d a t a b a s e management

    s y s t e m ,

    a s an

    e x a m p l e , r e l a t i o n s h i p s b e t W e e n da t a

    ( o r

    ? l e s ) a r e cre a t e d

    b y

    comparing d a t a ,

    such

    a s

    a c c o u n t

    numbers

    and

    names.

    The

    d a t a b e i n g compared a n d t h e

    r e s u l t s

    c a n b e s t r u c t u r e d i n t h e

    f o r m

    o f

    a b l e s . A o i n p r o c e s s

    i n c l u d e s

    m a t c h i n g

    r e c o r d s

    i n

    one t a b l e ( o r ? l e ) W i t h

    r e c o r d s

    i n a n o t h e r ,

    b a s e d

    on some

    c o n d i t i o n ,

    and

    c r e a t i n g a

    t h i r d t a b l e t h a t i n c l u d e s

    d a t a

    from

    t h e

    t a b l e s b e i n g

    j o i n e d . I n one

    e x a m p l e ,

    a n Order

    t a b l e

    can

    be

    o i n e d

    With

    a

    Customer

    a b l e

    t o

    c r e a t e

    a

    t h i r d t a b l e f o r

    a l l

    c u s t o m e r s

    Who p u r c h a s e d

    a

    p a r t i c u l a r p r o d u c t .

    [ 0 0 0 3 ]

    T h e d e f a u l t

    t y p e

    o f

    j o i n i s t h e i n n e r

    j o i n ,

    W h i c h

    p r o d u c e s a

    r e s u l t i n g

    r e c o r d Whenever tWo

    r e c o r d s ,

    one

    from

    e a c h i n p u t t a b l e ,

    s a t i s f y

    t h e

    m a t c h i n g

    c o n d i t i o n . C o n s i d e r

    a n o t h e r

    e x a m p l e t h a t m a t c h e s s h i p m e n t s W i t h

    r e c e i p t s . T h e

    j o i n Would

    p r o d u c e

    a t a b l e

    o f

    s h i p m e n t s

    t h a t

    h a v e b e e n

    r e c e i v e d b u t o m i t s h i p m e n t s

    t h a t

    h a v e n o t been

    r e c e i v e d .

    C o n t r a r i W i s e ,

    an

    o u t e r j o i n Would c r e a t e a t a b l e o f e v e r y

    s h i p m e n t , Whether o r n o t i t Was r e c e i v e d . Data f o r r e c e i v e d

    i t e m s

    i s

    a t t a c h e d t o t h e s h i p m e n t s .

    Empty

    ( o r n u l l ) ? e l d s

    Would b e a t t a c h e d t o s h i p m e n t s

    W i t h o u t

    r e c e i p t s .

    [ 0 0 0 4 ] M a t e ri a l i Z e d v i e W s ,

    a l s o

    c a l l e d i n d e x e d v i e W s , a re

    a

    mechanism f o r s p e e d i n g

    up

    p r o c e s s i n g

    o f

    d a t a b a s e q u e

    r i e s .

    A

    a t e r i a l i z e d

    vieW

    s

    a

    precomputed

    e s u l t t h a t

    m a y

    be

    u s e d

    to compute p a r t o r

    a l l o f

    q u e r y

    i n s t e a d

    o f computing

    t

    d i r e c t l y from b a s e t a b l e s .

    M a t e r i a l i Z e d

    v i e W s c a n p r o v i d e

    d r a m a t i c i m p r o v e m e n t s i n q u e r y p r o c e s s i n g t i m e .

    T o

    b e

    u s e f u l , a

    m a t e r i a l i Z e d vieW

    must be p d a t e d W hen any o f t s

    u n d e r l y i n g b a s e

    t a b l e s i s u p d a t e d .

    T h i s

    i s n o r m a l l y r efer r ed

    t o a s vieW

    m a i n t e n a n c e .

    E ? i c i e n t , i n c r e m e n t a l vieW main

    t e n a n c e

    a l g o r i t h m s a r e c u r r e n t l y

    knoWn o n l y

    f o r

    SPJG

    v i e W s ,

    t h a t i s , v i e W s c o m p o s e d o f s e l e c t , p r o j e c t a n d i n n e r

    j o i n o p e r a t o r s , W i t h a n o p t i o n a l a g g r e g a t i o n o p e r a t o r o n o p ,

    t h e a g g r e g a t i o n

    o p e r a t o r

    s u m m a r i z i n g t h e r e s u l t s o f t h e

    q u e r y .

    [ 0 0 0 5 ] P r i o r Work

    on

    i n c r e m e n t a l m a i n t e n a n c e o f m a t e r i

    a l i Z e d vieWs h a s f o c u s e d p r i m a r i l y

    on

    SPJG vieWs b u t

    one

    c o n v e n t i o n a l

    s y s t e m

    p r o v i d e s a mechanism f o r

    m a i n t a i n i n g

    o u t e r - j o i n v i e W s .

    H o W e v e r , i t

    d o e s n o t

    c o v e r

    a g g r e g a t e d

    v i e W s , a n d

    t h e

    mechanism

    may

    become g r o s s l y i n e f ? c i e n t

    f o r vieWs W i t h

    more

    t h a n

    a

    s i n g l e o u t e r j o i n .

    SUMMARY

    [ 0 0 0 6 ] The f o l l o W i n g p r e s e n t s a

    s i m p l i ? e d summary

    i n

    o r d e r t o p r o v i d e a b a s i c u n d e r s t a n d i n g o f

    some

    s p e c t s o f t h e

    d i s c l o s e d i n n o v a t i o n . T h i s summary i s n o t an e x t e n s i v e

    o v e r v i e W , a n d i t i s n o t i n t e n d e d t o i d e n t i f y k e y / c r i t i c a l

    elements

    o r t o

    d e l i n e a t e t h e scope t h e r e o f . I t s s o l e purpose

    i s t o

    p r e s e n t

    some c o n c e p t s i n a

    simpli?ed

    form a s a p r e l u d e

    t o

    t h e

    more d e t a i l e d

    d e s c r i p t i o n t h a t

    i s p r e s e n t e d l a t e r .

    [ 0 0 0 7 ] The s u b j e c t i n n o v a t i o n

    i s

    r e l a t e d

    t o

    q u e r y p r o c e s s

    i n g i n

    d a t a b a s e

    s y s t e m s , a n d

    p r o v i d e s

    t h e

    ? r s t g e n e r a l a n d

    A u g . 1 6 , 2 0 07

    p r a c t i c a l a l g o r i t h m s f o r m a i n t a i n i n g

    o u t e r - j o i n

    v i e W s ,

    i n c l u d i n g

    a g g r e g a t e d

    o u t e r - j o i n v i e W s . M a t e ri a l i Z e d v i e W s

    W i t h a n y c o m b i n a t i o n o f s e l e c t i o n , p r o j e c t i o n , i n n e r j o i n s ,

    o n e - s i d e d o u t e r j o i n s a n d f u l l o u t e r j o i n s , p l u s a n o p t i o n a l

    a g g r e g a t i o n

    on

    o p ,

    c a l l e d

    SPOJG

    i e W s ,

    c a n b e h a n d l e d

    by

    t h e

    d i s c l o s e d

    a l g o r i t h m ( s ) .

    [ 0 0 0 8 ] D e s c r i b e d

    h e r e i n i s

    a n a r c h i t e c t u r e f o r e x t e n d i n g

    i n c r e m e n t a l

    vieW

    maintenance

    t o SPOJG v i e W s . E x t e n s i o n

    i s by

    c r e a t i n g

    one o r more a l g o r i t h m s

    t h a t

    c o n s t r u c t

    i n c r e

    m e n t a l

    m a i n t e n a n c e

    e x p r e s s i o n s f o r SP0]G i e W s . Conven

    t i o n a l l y ,

    SPOJ e x p r e s s i o n s can be c o n v e r t e d

    t o

    a normal

    f o r m , f o r e x a m p l e , a j o i n - d i s j u n c t i v e n o r m a l f o r m . The

    d i s c l o s e d a l g o r i t h m ( s ) u t i l i Z e t h i s n o r m a l f o r m f o r o u t e r - j o i n

    e x p r e s s i o n s , a n d

    a l s o e x p l o i t

    d a t a b a s e

    c o n s t r a i n t s , f o r

    e x a m p l e ,

    f o r e i g n - k e y

    c o n s t r a i n t s ,

    t o

    r e du c e m a i n t e n a n c e

    o v e r h e a d . E x p e r i m e n t s shoW

    h a t

    m a i n t a i n i n g

    a n o u t e r - j o i n

    vieW need

    n o t

    be

    more

    e x p e n s i v e

    t h a n m a i n t a i n i n g

    an

    i n n e r - j o i n

    v i e W ; and

    f o r

    a g g r e g a t i o n

    v i e W s i t

    c a n

    e v e n

    b e

    c h e a p e r .

    [ 0 0 0 9 ] A c c o r d i n g l y , t h e i n v e n t i o n

    d i s c l o s e d

    a n d

    c l a i m e d

    h e r e i n , i n o n e a s p e c t t h e r e o f , c o m p r i s e s a

    c o m p u t e r - i m p l e

    mented s y s t e m t h a t f a c i l i t a t e s m a i n t e n a n c e o f m a t e r i a l i Z e d

    o u t e r - j o i n v i e W s . The s y s t e m c a n c o m p r i s e

    a

    vieW c r e a t i o n

    component f o r c r e a t i n g a m a t e r i a l i Z e d

    vieW d e ? n i t i o n

    t h a t

    i n c l u d e s

    o u t e r - j o i n s ,

    a

    c o n v e r s i o n

    c o m p o n e n t

    f o r c o n v e r t i n g

    vieW e x p r e s s i o n d e ? n i t i o n

    i n t o

    a normal f o r m , and a

    main

    t e n a n c e

    component f o r

    u p d a t i n g

    t h e s t o r e d

    m a t e r i a l i Z e d

    vieW r e s u l t a s s o c i a t e d W i t h t h e m a t e r i a l i Z e d vieW d e ? n i t i o n

    W hen an u n d e r l y i n g b a s e

    t a b l e

    i s modi?ed.

    [ 0 0 1 0 ]

    I n

    a n o t h e r s p e c t ,

    c o m p u t a t i o n s a n d

    m e t h o d o l o g i e s

    a re

    d i s c l o s e d f o r

    i d e n t i f y i n g

    d i r e c t l y -

    a n d

    i n d i r e c t l y - a f f e c t e d

    terms

    of

    an expression

    i n

    normal

    form

    a s a means f o r

    r e d u c i n g t h e

    o v e r h e a d o f v i e W m a i n t e n a n c e

    t h e r e b y m a k i n g

    e x p r e s s i o n s

    more

    e f ? c i e n t

    t o

    e x e c u t e .

    [ 0 0 1 1 ] I n

    y e t

    a n o t h e r

    i n n o v a t i v e a s p e c t ,

    m e t h o d o l o g i e s

    a r e

    p r o v i d e d f o r m a i n t a i n i n g a g g r e g a t e d v i e W s t h a t

    c o n t a i n

    o u t e r j o i n s .

    [ 0 0 1 2 ]

    T o t h e

    a c c o m p l i s h m e n t

    o f t h e

    f o r e g o i n g

    a n d

    e l a t e d

    e n d s , c e r t a i n i l l u s t r a t i v e a s p e c t s o f t h e d i s c l o s e d i n n o v a t i o n

    a r e d e s c r i b e d h e r e i n i n c o n n e c t i o n

    W i t h

    t h e f o l l o W i n g

    d e s c r i p t i o n a n d t h e a n n e x e d d r a W i n g s . T h e s e

    a s p e c t s

    a r e

    i n d i c a t i v e ,

    h o W e v e r ,

    o f

    b u t a feW

    o f

    t h e v a r i o u s Ways

    i n

    Which t h e p r i n c i p l e s

    d i s c l o s e d h e r e i n

    c a n

    b e

    employed a n d

    i s i n t e n d e d t o i n c l u d e a l l s u c h a s p e c t s

    a n d

    t h e i r e q u i v a l e n t s .

    O t h e r

    a d v a n t a g e s a n d n o v e l f e a t u r e s W i l l become a p p a r e n t

    f r o m

    t h e f o l l o W i n g

    d e t a i l e d

    d e s c r i p t i o n When c o n s i d e r e d i n

    c o n j u n c t i o n W i t h

    t h e

    d r a W i n g s .

    BRIEF

    DESCRIPTION OF

    THE

    DRAWINGS

    [ 0 0 1 3 ]

    F I G .

    1 i l l u s t r a t e s a

    c o m p u t e r - i m p l e m e n t e d

    s y s t e m

    t h a t f a c i l i t a t e s maintenance of a m a t e r i a l i Z e d v i e W .

    [ 0 0 1 4 ] F I G . 2

    i l l u s t r a t e s a

    methodology

    o f

    m a i n t a i n i n g

    a

    m a t e r i a l i Z e d

    vieW i n a c c o r d a n c e W i t h

    a n o v e l a s p e c t .

    [ 0 0 1 5 ] F I G . 3 i l l u s t r a t e s

    s u b s u m p t i o n

    g r a p h s

    f o r

    t h e

    e x a m p l e SPOJ v i e W s V1

    a n d

    v 2 .

    [ 0 0 1 6 ]

    F I G . 4 5 i l l u s t r a t e s a methodology o f g e n e r a t i n g a

    s u b s u m p t i o n g r a p h and n e t c o n t r i b u t i o n s t o t h e v i e W .

    [ 0 0 1 7 ]

    F I G . 5 6

    i l l u s t r a t e s

    s h o W s t h r e e

    m a i n t e n a n c e

    g r a p h s

    f o r v i e W Vl h a t a r e d e r i v e d f r o m t h e

    s u b s u m p t i o n

    g r a p h f o r

    V1 o f F I G . 3 .

  • 8/11/2019 Maintenance of Materialized

    16/30

    US

    007/0192283 A 1

    [ 0 0 1 8 ] F I G .

    6 i l l u s t r a t e s a

    methodology

    o f c o n s t r u c t i n g a

    m a i n t e n a n c e g r a p h f o r i d e n t i f y i n g t e r m s a f f e c t e d

    by

    a n

    u p d a t e , i n

    a c c o r d a n c e W i t h

    t h e d i s c l o s e d i n n o v a t i o n .

    [ 0 0 1 9 ]

    F I G . 7

    i l l u s t r a t e s

    a m e t h o d o l o g y

    o f p e r f o r m i n g

    vieW maintenance i n

    a c c o r d a n c e W i t h an i n n o v a t i v e a s p e c t .

    [ 0 0 2 0 ] F I G . 8 i l l u s t r a t e s V2

    m a i n t e n a n c e

    g r a p h s

    f o r

    u p d a t e s t o

    t a b l e

    C n d

    f o r

    u p d a t e s

    t o

    t a b l e O .

    [ 0 0 2 1 ] F I G . 9

    i l l u s t r a t e s t h e

    r e d u c e d

    V2

    m a i n t e n a n c e

    g r a p h s

    o f

    F I G .

    8 b y e x p l o i t i n g t h e f o r e i g n k e y c o n s t r a i n t s

    betWeen L and O , and betWeen

    O

    nd C .

    [ 0 0 2 2 ] F I G . 1 0

    i l l u s t r a t e s a

    How diagram

    o f a

    methodol

    o g y o f

    c r e a t i n g

    a r e d u c e d m a i n t e n a n c e

    g r a p h

    b y

    e l i m i n a t i n g

    a d d i t i o n a l n o d e s , t h e r e b y

    s i m p l i f y i n g

    m a i n t e n a n c e a n d

    i n c r e a s i n g p e r f o r m a n c e .

    [ 0 0 2 3 ]

    F I G .

    1 1 i l l u s t r a t e s

    m a i n t e n a n c e

    g r a p h s

    f o r

    u p d a t e s

    to t a b l e s T

    and R .

    [ 0 0 2 4 ] FIG. 1 2

    i l l u s t r a t e s a system t h a t c o n s t r u c t s an

    e x p r e s s i o n

    f o r c o m p u t i n g

    t h e

    o u t e r u n i o n o f

    c h a n g e s

    t o

    d i r e c t l y - a f f e c t e d

    t e r m s .

    [ 0 0 2 5 ]

    F I G .

    1 3

    i l l u s t r a t e s a m e t h o d o l o g y

    o f c o n s t r u c t i n g

    e f ? c i e n t m a i n t e n a n c e

    e x p r e s s i o n s

    f o r

    a n o u t e r - j o i n

    v i e W .

    [ 0 0 2 6 ]

    F I G . 1 4

    i l l u s t r a t e s a

    How diagram

    o f a

    methodol

    o g y o f m a i n t a i n i n g a n a g g r e g a t e d o u t e r - j o i n v i e W .

    [ 0 0 2 7 ] F I G . 1 5 i l l u s t r a t e s

    a b l o c k

    diagram o f

    a computer

    o p e r a b l e

    t o

    e x e c u t e t h e d i s c l o s e d m a t e r i a l i z e d v i e W

    main

    tenance

    a r c h i t e c t u r e .

    [ 0 0 2 8 ]

    F I G .

    1 6 i l l u s t r a t e s a s c h e m a t i c

    b l o c k

    diagram o f an

    e x e m p l a r y

    c o m p u t i n g

    e n v i r o n m e n t o p e r a b l e t o

    m a i n t a i n

    m a t e r i a l i z e d

    v i e W s

    i n a c c o r d a n c e W i t h a n o t h e r a s p e c t .

    DETAILEDDESCRIPTION

    [ 0 0 2 9 ]

    The

    i n n o v a t i o n i s no W d e s c r i b e d W i t h r e f e r e n c e to

    t h e d r a W i n g s , Wherein

    l i k e

    r e f e r e n c e

    n u m e r a l s a r e used

    to

    r e f e r

    t o

    l i k e

    e l e m e n t s t h r o u g h o u t .

    I n t h e f o l l o W i n g d e s c r i p

    t i o n ,

    f o r p u r p o s e s

    o f

    e x p l a n a t i o n ,

    n u m e r o u s

    s p e c i ? c d e t a i l s

    a r e

    s e t f o r t h

    i n o r d e r to

    p r o v i d e

    a t h o r o u g h

    u n d e r s t a n d i n g

    t h e r e o f . I t ma y be

    e v i d e n t , h o W e v e r ,

    t h a t

    t h e

    i n n o v a t i o n c a n

    b e p r a c t i c e d W i t h o u t t h e s e

    s p e c i ? c

    d e t a i l s . I n o t h e r

    i n s t a n c e s , Well-knoWn

    s t r u c t u r e s

    and d e v i c e s a r e

    shoWn

    i n

    b l o c k d i a g r a m form i n

    o r d e r

    t o

    f a c i l i t a t e

    a d e s c r i p t i o n

    t h e r e o f .

    [ 0 0 3 0 ] As s e d

    i n

    t h i s a p p l i c a t i o n , t h e t e r m s

    c o m p o n e n t

    and

    system a r e

    i n t e n d e d to r e f e r t o a c o m p u t e r - r e l a t e d

    e n t i t y , e i t h e r h a r d W a r e , a

    c o m b i n a t i o n

    o f h a r d W a r e and

    s o f t W a r e , s o f t W a r e ,

    o r s o f t W a r e

    i n

    e x e c u t i o n .

    F o r e x a m p l e ,

    a

    component

    can b e ,

    b u t i s

    n o t

    l i m i t e d

    t o

    b e i n g , a p r o c e s s

    running

    on a p r o c e s s o r , a p r o c e s s o r , a

    hard

    d i s k d r i v e ,

    m u l t i p l e

    s t o r a g e d r i v e s ( o f o p t i c a l

    a n d / o r m a g n e t i c

    s t o r a g e

    medium), an

    o b j e c t ,

    an e x e c u t ab l e , a t h r e a d of e x e c u t i o n , a

    p r o g r a m ,

    a n d / o r

    a c o m p u t e r . By Way o f l l u s t r a t i o n , b o t h an

    application running on a s e r v e r and t h e s e r v e r

    can

    be a

    component.

    One r mo re

    components

    can r e s i d e Within a

    p r o c e s s

    a n d / o r t h r e a d of x e c u t i o n , and

    a component can be

    l o c a l i z e d

    on

    one computer

    and/

    r d i s t r i b u t e d betWeen

    tWo

    or

    more computers.

    [ 0 0 3 1 ] R e f e r r i n g i n i t i a l l y t o t h e d r a W i n g s ,

    F I G . 1 i l l u s

    t r a t e s a computer-implemented s y s t e m 100 t h a t f a c i l i t a t e s

    maintenance of

    a m a t er i a l i z e d v i e W . T he

    system

    100 can

    A u g . 1 6 , 2 0 07

    c o m p r i s e a v i e W c r e a t i o n component

    1 0 2 f o r

    c r e a t i n g mate

    r i a l i z e d

    v i e W s ,

    i n c l u d i n g

    o u t e r - j o i n v i e W s , a

    c o n v e r s i o n

    component 1 0 4 f o r c o n v e r t i n g v i e W e x p r e s s i o n s i n t o a

    n o r m a l

    f o r m ,

    and a

    m a i n t e n a n c e component 1 0 6

    f o r

    u p d a t

    i n g t h e m at e r i a l i z e d

    v i e W s

    c r e a t e d

    b y

    t h e

    v i e W c o m p o n e n t

    1 0 2 .

    [ 0 0 3 2 ]

    The

    s y s t e m

    f a c i l i t a t e s i n c r e m e n t a l

    m a i n t e n a n c e o f

    m a t e r i a l i z e d

    SPOJG ( o r s e l e c t , p r o j e c t i o n ,

    o u t e r - j o i n a n d

    o p t i o n a l g r o u p - b y ) v i e W s , t h a t i s , v i e W s Where

    some

    r l l o f

    t h e j o i n s a r e

    o u t e r j o i n s . T h i s i s a c c o m p l i s h e d b y n o v e l

    a l g o r i t h m s

    t h a t

    c o n s t r u c t i n c r e m e n t a l m a i n t e n a n c e e x p r e s

    s i o n s

    f o r

    SPOJG i e W s . C o n v e n t i o n a l l y , SPOJ e x p r e s s i o n s

    can be c o n v e r t e d t o

    a

    normal

    f o r m ,

    f o r e x a m p l e ,

    a

    j o i n

    d i s j u n c t i v e

    n o r m a l

    f o r m . The

    c o n v e r s i o n

    c o m p o n e n t

    1 0 4

    i n c l u d e s one o r more a l g o r i t h m ( s )

    f o r

    c o n v e r t i n g o u t e r - j o i n

    e x p r e s s i o n s t o t h i s n o r m a l f o r m a n d e x p l o i t s c o n s t r a i n t s ,

    f o r

    e x a m p l e ,

    f o r e i g n - k e y

    c o n s t r a i n t s ,

    t o

    r e du c e m a i n t e n a n c e

    o v e r h e a d .

    [ 0 0 3 3 ] T h e

    s y s t e m

    1 0 0 p r o v i d e s t h e

    ? r s t

    g e n e r a l

    a n d

    p r a c t i c a l

    a l g o r i t h m s f o r h a n d l i n g v i e W s

    W i t h

    m u l t i p l e

    o u t e r

    j o i n s a n d

    a l s o

    a g g r e g a t e d o u t e r - j o i n

    v i e W s . M a t e r i a l i z e d

    v i e W s W i t h a n y

    c o m b i n a t i o n o f

    s e l e c t i o n s , i n n e r j o i n s ,

    o n e - s i d e d

    o u t e r j o i n s a n d f u l l o u t e r j o i n s , p l u s a n

    o p t i o n a l

    a g g r e g a t i o n

    on

    t o p , c a n

    b e

    h a n d l e d

    by t h e

    s y s t e m

    1 0 0 .

    [ 0 0 3 4 ]

    F I G . 2

    i l l u s t r a t e s

    a methodology

    o f

    m a i n t a i n i n g

    a

    m a t e r i a l i z e d

    vieW

    n

    a c c o r d a n c e W i t h

    a

    n o v e l a s p e c t . W h i l e ,

    f o r

    p u r p o s e s o f

    s i m p l i c i t y of e x p l a n a t i o n , t h e one

    o r

    more

    m e t h o d o l o g i e s

    shoWn

    e r e i n , e . g . , i n

    t h e f o r m o f a

    How h a r t

    o r

    How

    iagram, a r e s ho W n and described

    a s a

    s e r i e s of c t s ,

    i t

    i s to

    b e

    u n d e r s t o o d

    a n d a p p r e c i a t e d

    t h a t t h e s u b j e c t

    i n n o v a t i o n i s n o t l i m i t e d by t h e o r d e r

    of

    a c t s ,

    a s

    some a c t s

    may, i n

    accordance t h e r e W i t h ,

    occur

    i n a

    d i f f e r e n t

    o r d e r

    a n d / o r c o n c u r r e n t l y W i t h

    o t h e r

    acts from t h a t shoWn

    and

    d e s c r i b e d

    h e r e i n .

    F o r

    e x a m p l e ,

    t h o s e

    s k i l l e d

    i n

    t h e

    a r t

    W i l l

    u n d e r s t a n d

    a n d

    a p p r e c i a t e t h a t a m e t h o d o l o g y c o u l d a l t e r

    n a t i v e l y be r e p r e s e n t e d a s a

    s e r i e s

    of i n t e r r e l a t e d states o r

    e v e n t s , such a s i n a state

    d i a g r a m .

    Moreover,

    n o t

    a l l i l l u s

    t ra t e d a c t s may e r e q u i r e d t o i m p l e m e n t a methodology i n

    a c c o r d a n c e

    W i t h t h e

    i n n o v a t i o n .

    [ 0 0 3 5 ]

    At 2 0 0 ,

    u p d a t e s o f

    a t a b l e T a r e

    r e c e i v e d

    f o r

    p r o c e s s i n g .

    The u p d a t e s c o n s i s t o f

    a s e t

    o f neW t u p l e s

    i n s e r t e d i n t o

    t a b l e T

    o r a set of u p l e s

    d e l e t e d

    from t a b l e T .

    At 2 0 2 ,

    t h e ? r s t vieW

    d e ? n i t i o n V

    s r e t r i e v e d t o be c o n s i d

    e r e d

    f o r m a i n t e n a n c e .

    At 2 0 4 , a c h e c k

    i s

    performed

    t o

    d e t e r m i n e W h e t h e r a l l v i e W s h a v e b e e n p r o c e s s e d . I f t h a t i s

    t h e

    c a s e ,

    p r o c e s s i n g t e r m i n a t e s . O t h e r W i s e , p r o c e s s i n g c o n

    t i n u e s a t 2 0 6 , Where i t i s d e t e r m i n e d

    W h e t h e r

    t h e

    vieW

    r e f e r e n c e s t h e

    u p d a t e d

    t a b l e

    T .

    I f i t d o e s n o t , t h e

    n e x t

    vieW

    i s

    r e t r i e v e d ,

    i n 2 0 8 ,

    a n d

    p r o c e s s i n g c o n t i n u e s

    a t

    2 0 6 .

    I f

    t h e

    v i e W

    r e f e r e n c e s

    t a b l e T ,

    t h e

    SPOJ ar t o f

    t h e

    v i e W

    d e ? n i t i o n ,

    i . e . ,

    t h e n o n - a g g r e g a t e d p a r t o f t h e v i e W d e ? n i t i o n , i s

    c o n v e r t e d

    i n t o

    n o r m a l f r o m ,

    a t

    2 1 0 . At 2 1 2 ,

    t h e

    i n c r e m e n t a l

    m a i n t e n a n c e e x p r e s s i o n f o r t h e

    v i e W

    i s g e n e r a t e d .

    A t 2 1 4 ,

    t h e v i e W m a i n t e n a n c e e x p r e s s i o n i s

    e v a l u a t e d

    and h e re s u l t

    a p p l i e d t o t h e

    v i e W , t h e r e b y b r i n g i n g

    t h e v i e W u p t o

    d a t e

    W i t h

    t h e b a s e t a b l e s . P r o c e s s i n g

    t h e r e a f t e r

    c o n t i n u e s

    W i t h

    t h e

    n e x t

    v i e W , a t s t e p 2 0 8 , w i t h How back

    to

    2 0 4 .

    [ 0 0 3 6 ] I n o p e r a t i o n , c o n s i d e r t h e f o l l o W i n g e x a m p l e . A

    v i e W , o j _ v i e W ,

    p r e s e n t e d b e l o W ,

    c o n s i s t s o f o u t e r o i n s o f t h e

    t a b l e s P a r t ,

    L i n e i t e m

    and O r d e r s

    from

    a

    TPC-H ( t r a n s a c t i o n

    p r o c e s s i n g

    p e r f o r m a n c e

    c o u n c i l ,

    t y p e

    H b e n c h m a r k ) d a t a

    b a s e .

    (TPC i s

    a n

    o r g a n i z a t i o n

    t h a t b e n c h m a r k s t r a n s a c t i o n

  • 8/11/2019 Maintenance of Materialized

    17/30

    US

    007/0192283 A 1

    p r o c e s s i n g s y s t e m s . The TPC-H benchmark m e a s u r e s d e c i

    s i o n

    s u p p o r t

    p e r f o r m a n c e

    t h a t r e ? e c t s m u l t i p l e a s p e c t s

    o f

    s y s t e m c a p a b i l i t y

    t o p r o c e s s q u e r i e s . )

    I t

    i s g i v e n t h a t

    p _ p a r t

    k e y

    s t h e

    p r i m a r y

    k e y

    o f a r t a n d o _ o r d e r k e y

    i s

    t h e p r i m a r y

    k e y o f

    O r d e r s ,

    a n d

    t h e r e

    i s

    a

    f o r e i g n

    k e y

    c o n s t r a i n t

    b e t W e e n

    L i n e i t e m and

    P a r t ,

    and

    a l s o

    one betWeen L i n e i t e m

    and

    O r d e r s .

    c r e a t e vieW OjiVl?W a s

    s e l e c t p i p a r t k e y , p i n a l n e , p i r e t a i l p r i c e , o i o r d e r k e y , o i c u s t k e y ,

    l i l i n e n u m b e r ,

    l i q u a n t i t y ,

    l i e x t e n d e d p r i c e

    f r o m

    p a r t

    l e ? o u t e r j o i n

    ( o r d e r s

    l e ? o u t e r j o i n l i n e i t e m on liorderkey =

    oiorderkey) on pipartkey =

    lipartkey

    [ 0 0 3 7 ] F i r s t , a n a l y Z e W h a t

    t y p e s

    o f t u p l e s t h e v i e W may

    c o n t a i n .

    The o i n

    b e t W e e n

    O r d e r s

    a n d L i n e i t e m

    W i l l

    r e t a i n

    a l l L i n e i t e m

    t u p l e s

    b e c a u s e t h e

    j o i n m a t c h e s

    t h e

    f o r e i g n k e y

    c o n s t r a i n t

    b e t W e e n

    l _ o r d e r k e y

    a n d

    o _ o r d e r k e y .

    I f

    t h e

    O r d e r s

    t a b l e

    c o n t a i n s some o r p h a n e d O r d e r s t u p l e s W i t h o u t match

    i n g

    L i n e i t e m

    t u p l e s , t h e o r p h a n e d t u p l e s W o u l d

    o c c u r

    i n t h e

    r e s u l t

    n u l l - e x t e n d e d

    on l l L i n e i t e m

    c o l u m n s . The u t e r j o i n

    W i t h

    P a r t

    W i l l n o t e l i m i n a t e a n y

    r e a l { L i n e i t e m ,

    O r d e r s }

    t u p l e s

    b e c a u s e t h i s j o i n

    i s

    a l s o

    a f o r e i g n - k e y

    j o i n b u t

    i t

    W i l l

    e l i m i n a t e a l l t u p l e s t h a t a r e n u l l - e x t e n d e d on

    Lineitem

    c o l u m n s .

    P a r t

    t u p l e s t h a t d o n o t j o i n W i t h a n y t h i n g W i l l b e

    r e t a i n e d i n t h e re s u l t

    b e c a u s e

    t h e j o i n i s a n o u t e r o i n . H e n c e ,

    t h e ? n a l r e s u l t W i l l c o n t a i n

    o n e c o m p l e t e { L i n e i t e m ,

    O r d e r s ,

    P a r t } t u p l e f o r e a c h L i n e i t e m t u p l e a n d s o m e o r p h a n e d P a r t

    t u p l e s

    n u l l - e x t e n d e d

    on c o l u m n s from

    i n e i t e m a n d

    O r d e r s ,

    b u t no { L i n e i t e m , O r d e r s }

    and

    no

    O r d e r s

    t u p l e s .

    [ 0 0 3 8 ] N e x t , c o n s i d e r hoW t o m a i n t a i n t h e v i e W

    i n

    r e s p o n s e t o i n s e r t i o n s i n t o one

    of

    h e

    base

    t a b l e s . Suppose a

    s e t

    o f

    neW

    a r t t u p l e s

    i s

    i n s e r t e d i n t o t h e P a r t

    t a b l e .

    The

    vieW

    c a n

    t h e n b e

    b r o u g h t

    u p - t o - d a t e b y

    s i m p l y i n s e r t i n g t h e

    neW

    p a r t t u p l e s ,

    a p p r o p r i a t e l y

    e x t e n d e d W i t h n u l l s , i n t o

    t h e

    v i e W .

    N o t h i n g m o r e

    i s

    r e q u i r e d b e c a u s e t h e

    f o r e i g n

    k e y c o n s t r a i n t

    betWeen

    L i n e i t e m

    and a r t g u a r a n t e e s t h a t a neW p a r t t u p l e

    d o e s n o t

    j o i n

    W i t h a n y L i n e i t e m t u p l e s .

    I f

    t h e neW a r t t u p l e

    d i d , t h e n t h e

    j o i n i n g

    L i n e i t e m

    t u p l e s W o u l d h a v e

    v i o l a t e d t h e

    f o r e i g n

    k e y c o n s t r a i n t .

    [ 0 0 3 9 ]

    I n s e r t i o n s

    i n t o t h e O r d e r s

    t a b l e

    W i l l have no

    effect

    on h e vieW s o n o t h i n g n e e d s t o be

    d o n e .

    AneW r d e r s t u p l e

    c a n n o t j o i n W i t h a n y

    e x i s t i n g

    L i n e i t e m

    t u p l e s

    b e c a u s e o f

    t h e

    f o r e i g n

    k e y

    c o n s t r a i n t

    b e t W e e n

    L i n e i t e m

    a n d

    O r d e r s . The

    neW r d e r s t u p l e , a p p r o p r i a t e l y

    e x t e n d e d W i t h

    u l l s , W i l l n o t

    b e

    c o n t a i n e d

    i n t h e vieW e i t h e r b e c a u s e , a s d i s c u s s e d ab o v e ,

    o r p h a n e d O r d e r s

    t u p l e s a r e

    e l i m i n a t e d

    from t h e

    v i e W .

    [ 0 0 4 0 ] F i n a l l y , c o n s i d e r i n s e r t i o n s i n t o t h e L i n e i t e m

    t a b l e .

    Suppose t h e n e W l i n e i t e m s a r e c o n t a i n e d i n a t a b l e

    neW_li

    n e i t e m s . The v i e W c a n t h e n b e u p d a t e d

    u s i n g t h e f o l l o W i n g

    s e q u e n c e o f SQL

    s t a t e m e n t s .

    s e l e c t p i p a r t k e y , p i n a l n e , p i r e t a i l p r i c e , o i o r d e r k e y , o i c u s t k e y ,

    l i l i n e n u m b e r ,

    l i q u a n t i t y ,

    l i e x t e n d e d p r i c e

    i n t o d e l t a l

    f r o m

    n e w i l i n e i t e r n s , o r d e r s ,

    p a r t

    Where

    liorderkey

    = oiorderkey and

    lipartkey

    = pipartkey

    i n s e r t i n t o O j i V l ? W

    s e l e c t

    from #deltal

    A u g . 1 6 , 2 0 07

    - c o n t i n u e d

    d e l e t e

    f r o m

    O j i V l ? W

    W h e r e o i o r d e r k e y i s

    n u l l

    a n d p i p a r t k e y

    i n ( s e l e c t

    p i p a r t k e y f r o m

    # d e l t a l )

    [ 0 0 4 1 ] The rs t s t a t e m e n t

    c o m p u t e s t h e s e t

    o f

    t u p l e s t o b e

    i n s e r t e d

    i n t o

    t h e

    vieW

    and s a v e s

    them

    i n a temporary t a b l e

    d el tal

    ( t o

    a v o i d c o m p u t i n g t h e s a m e e x p r e s s i o n W i c e ) . T h e

    second

    s t a t e m e n t adds

    t h e neW u p l e s i n t o t h e

    v i e W . The

    neW

    L i n e i t e m t u p l e s ma y c a u s e some orphaned P a r t t u p l e s t o be

    e l i m i n a t e d from

    t h e v i e W .

    The

    t h i r d

    s t a t e m e n t

    d e l e t e s

    a l l

    o r p h a n e d P a r t

    t u p l e s ,

    i f a n y , Whose p _ p a r t k e y

    v a l u e o c c u r s

    among t h e

    n e W l y i n s e r t e d

    t u p l e s .

    I n

    o t h e r W o r d s , i t

    de le t e s

    a l l o r p h a n s W h o c e a s e t o b e o r p h a n s b e c a u s e o f

    t h e

    i n s e r t .

    [ 0 0 4 2 ] T h e f o l l o W i n g d e s c r i p t i o n c o n t a i n s p r e l i m i n a r y

    m a t e r i a l

    a n d i n t r o d u c e s c o n c e p t s

    u s e d

    l a t e r .

    [ 0 0 4 3 ]

    A

    e l e c t i o n o p e r a t o r W i l l

    b e d e n o t e d

    i n

    t h e

    n o r m a l

    W a y

    a s o p , Where p i s a

    p r e d i c a t e . A

    r e d i c a t e p

    r e f e r e n c i n g

    some set S of

    columns

    s s a i d

    t o

    be s t r o n g o r n u l l - r e j e c t i n g

    i f i t

    evaluates

    t o f a l s e

    or unknoWn

    n

    a tuple

    a s

    soon

    a s

    one

    o f t h e c o l u m n s i n S

    i s

    n u l l . P r o j e c t i o n

    ( W i t h o u t

    d u p l i c a t e

    e l i m i n a t i o n ) i s

    d e n o t e d

    by

    o ,

    Where c i s a l i s t o f c o l u m n s .

    B o r r o w i n g

    f r o m

    SQL s t r u c t u r e d

    q u e r y

    l a n g u a g e ) ,

    t h e s h o r t

    hand . i s used o d e n o t e a l l columns o f t a b l e T . An p e r a t o r

    i s

    a l s o n e e d e d t h a t r e m o v e s d u p l i c a t e s

    ( s i m i l a r

    to

    SQLs

    s e l e c t d i s t i n c t ) ,

    W h i c h

    i s d e n o t e d b y 6 .

    [ 0 0 4 4 ] A

    p e c i a l p r e d i c a t e

    N u l l ( T )

    a n d i t s

    n e g a t i o n

    ~ N u l l ( T ) W i l l b e

    u s e d .

    N u l l ( T ) e v a l u a t e s t o t r u e

    i f a t u p l e

    i s

    n u l l - e x t e n d e d on

    t a b l e

    T .

    N u l l ( T )

    c a n

    be implemented

    i n

    SQL s T . C s n u l l , Where C s any

    column

    o f T t h a t

    c a n n o t c o n t a i n

    a n u l l

    v a l u e .

    W h e n

    p p l y i n g

    t h e s e p r e d i c a t e s

    to

    a

    s e t

    o f

    t a b l e s

    T ,

    t h e p r e d i c a t e s

    NN(T)

    and

    N(T)

    c a n

    be

    used Which

    a r e

    de?ned

    a s

    N N ( T ) = / \ t T ~ N u l l ( t ) and

    N(T)=

    A K T N u l l ( t ) .

    [ 0 0 4 5 ] A chema S i s a s e t o f

    a t t r i b u t e s

    ( c o l u m n n a m e s ) .

    L e t T

    and

    2 b e

    t a b l e s W i t h schemas

    S

    and 2, r e s p e c t i v e l y .

    T h e o u t e r

    u n i o n ,

    d e n o t e d

    b y

    T

    U T 2 ,

    ? r s t

    n u l l - e x t e n d s ( p a d s

    W i t h u l l s ) t h e

    t u p l e s

    o f e a c h o p e r a n d

    t o

    s c h e m a S l ( E S 2 a n d

    t h e n

    t a k e s t h e

    u n i o n

    o f t h e r e s u l t s ( W i t h o u t d u p l i c a t e e l i m i

    n a t i o n ) . O u t e r

    ( s e t )

    d i ? f e r e n c e ,

    d e n o t e d b y 1 : 1 , i s d e ? n e d

    i n

    a

    similar manner.

    [ 0 0 4 6 ] A u p l e t l i s s a i d t o subsume a t u p l e t 2 i f t h e y a r e

    de?ned on h e same schema, l a g r e e s With

    2

    on l l columns

    Where t h e y

    b o t h a r e

    n o n - n u l l ,

    a n d

    t 1 c o n t a i n s f e W e r n u l l

    v a l u e s

    t h a n t 2 .

    The o p e r a t o r

    r e m o v a l o f

    subsumed t u p l e s

    o f

    T ,

    d e n o t e d

    by

    T j ,

    r e t u r n s t h e t u p l e s

    o f

    T

    t h a t

    a r e

    n o t

    s u b s u m e d b y a n y o t h e r

    t u p l e

    i n T .

    [ 0 0 4 7 ] The minimum n i o n o f a b l e s T 1

    a n d T 2

    i s d e ? n e d

    a s

    T l o T 2 = ( T l U T l ) j .

    Minimum

    n i o n

    h a s l o W e r p r e c e d e n c e

    t h a n j o i n .

    I t

    c a n b e shoWn t h a t minimum u n i o n i s b o t h

    commutative and a s s o c i a t i v e .

    [ 0 0 4 8 ] L e t

    T 1

    a n d

    T 2 b e

    t a b l e s

    W i t h d i s j o i n t s c h e m a s

    S 1

    a n d

    S 2 ,

    r e s p e c t i v e l y , a n d

    p a p r e d i c a t e r e f e r e n c i n g some

    s u b s e t o f t h e c o l u m n s i n ( S 1 6 E 8 2 ) .

    The ( i n n e r )

    j o i n

    o f

    t h e

    t a b l e s i s

    d e ? n e d a s

    T 1 l > < p T 2 = { ( t l , t 2 ) ] t 1 e T l , t 2 e T 2 ,

    p ( t l , t 2 ) } .

    T h e l e f t s e m i j o i n i s d e ? n e d a s

    T l > < p l s T 2 = { l l l e T l ,

    ( 3 t 2 e T 2 ] p ( t l , t 2 ) ) } ,

    t h a t i s ,

    a

    t u p l e

    i n T 1

    q u a l i ? e s

    i f

    i t

    j o i n s

    W i t h some

    t u p l e i n T 2 .

    The e f t

    a n t i ( s e m i ) j o i n

    i s

    de?ned a s

  • 8/11/2019 Maintenance of Materialized

    18/30

    US

    007/0192283 A 1

    T l l > < l p l a T 2 = { t l l t l e T l ,

    ( $ t 2 e T 2 ] p ( t l , t 2 ) ) } , t h a t i s , a t u p l e

    i n

    T 1

    q u a l i ? e s i f

    i t

    d o e s n o t j o i n

    W i t h

    a n y t u p l e i n T 2 . The l e f t

    o u t e r j o i n c a n

    b e

    e x p r e s s e d a s

    T l l > < p 1 T 2 = T l l > < p T 2 o T 1 .

    The

    r i g h t

    o u t e r

    o i n c a n

    b e

    e x p r e s s e d

    s T 1 > < 1 r T 2 = T 2 l > < 1 p 1 T l .

    T h e

    f u l l

    o u t e r j o i n

    c a n b e e x p r e s s e d

    a s T 1 l > < 1 p f T 2 = T l

    > < p T 2 o T l o T 2 .

    [ 0 0 4 9 ]

    As d e s c r i b e d h e r e i n , i t

    i s assumed h a t e v e r y

    b a s e

    t a b l e

    h a s

    a u n i q u e k e y , Which

    s u s u a l l y

    t h e c a s e i n p r a c t i c e .

    A l l

    m a t e r i a l i z e d vieWs a r e

    assumed o

    have

    a

    u n i q u e key and

    p r e d i c a t e s a r e assumed

    t o be

    n u l l - r e j e c t i n g on

    l l

    columns

    r e f e r e n c e d .

    [ 0 0 5 0 ] VieW i n c r e m e n t a l m a i n t e n a n c e

    e x p r e s s i o n s a r e

    d e r i v e d b a s e d on h e j o i n - d i s j u n c t i v e normal form f o r SP0]

    e x p r e s s i o n s . T h r o u g h o u t t h i s d e s c r i p t i o n , t h e f o l l o w i n g

    example

    d a t a b a s e c o n t a i n i n g

    t h r e e

    t a b l e s W i l l b e u s e d

    as

    modeled on t h e t a b l e s

    C u s t o m e r , O r d e r s , L i n e i t e m o f

    t h e

    TPC-H

    d a t a b a s e .

    C ( c k , c n , c n k ) , O ( o k , o c k , o d , o t p ) , L

    l o k , l n , l p k , l q , l p )

    [ 0 0 5 1 ] N u l l s

    a r e

    n o t

    a l l o W e d i n

    any

    of

    t h e

    c o l u m n s .

    U n d e r l i n e d c o l u m n s f o r m t h e k e y

    o f e a c h t a b l e .

    TWo

    o r e i g n

    key

    c o n s t r a i n t s a r e

    d e ? n e d :

    O.ock e f e r e n c e s

    C . c k and . l o k

    r e f e r e n c e s

    O . o k .

    [ 0 0 5 2 ] C o n s i d e r a n e x a m p l e v i e W h a v i n g

    t h e f o l l o W i n g

    d e ? n i t i o n ,

    Q = C > < c k : o c k l o ( O > < o k : l o k l o ( 0 l p > 5 O O L ) )

    [ 0 0 5 3 ]

    The i e W c o n t a i n s a l l

    c u s t o m e r s t o g e t h e r

    W i t h

    t h e i r

    o r d e r s ,

    i f a n y , and

    l i n e

    i t e m s W i t h a p r i c e

    o v e r

    5 0 0 , i f a n y .

    The e s u l t

    W i l l

    c o n t a i n t u p l e s o f t h r e e d i f f e r e n t

    t y p e s .

    [ 0 0 5 4 ]

    l . C O L - t u p l e s , t h a t i s ,

    t u p l e s

    f o r m e d b y c o n c a t

    e n a t i n g a t u p l e

    f r o m

    C , a t u p l e

    from

    O

    n d

    a t u p l e

    f r o m

    L .

    T h e r e

    W i l l b e o n e COL-tuple f o r e v e r y L

    t u p l e t h a t

    s a t i s ? e s

    t h e p r e d i c a t e

    l p > 5 0 0 .

    [ 0 0 5 5 ]

    2 .

    C O - t u p l e s ,

    t h a t i s ,

    t u p l e s

    c o m p o s e d b y

    c o n

    c a t e n a t i o n o f

    a

    t u p l e from C ,

    a

    t u p l e from O nd u l l s

    f o r a l l columns o f L . T h e r e W i l l be one s u c h

    t u p l e

    f o r

    e v e r y O - t u p l e t h a t d o e s n o t j o i n

    W i t h

    a n y L - t u p l e

    s a t i s f y i n g l p > 5 0 0 .

    [ 0 0 5 6 ] 3 . C - t u p l e s , t h a t

    i s ,

    t u p l e s c o m p o s e d o f a t u p l e

    from C

    i t h n u l l s

    f o r a l l columns

    o f

    O

    nd

    L . There

    W i l l

    be o n e

    s u c h t u p l e f o r

    e v e r y C

    u p l e t h a t

    d o e s

    n o t

    j o i n

    W i t h

    a n y

    t u p l e

    i n

    O .

    [ 0 0 5 7 ] T h e e s u l t c o n t a i n s a l l t u p l e s i n t h e o i n C l > < C k = O Ck O

    l > q o k = l o k ( o l p > s 0 0 L ) , a l l

    t u p l e s i n

    t h e

    j o i n

    C l > < 1 C k = O C k O , a n d a l s o

    A u g . 1 6 , 2 0 07

    a l l t u p l e s

    i n

    C .

    Each f t h e s e t h r e e

    s u b - r e s u l t s i s r e p r e s e n t e d

    i n t h e

    r e s u l t

    i n a minimal W a y . F o r e x a m p l e , i f a t u p l e

    ( c l , n u l l , n u l l ) a p p e a r s i n

    t h e r e s u l t ,

    t h e n

    t h e r e

    e x i s t s

    a t u p l e

    c l

    i n

    C , b u t t h e r e i s

    no

    t u p l e

    01

    i n

    0

    u c h t h a t ( c l , o l )

    a p p e a r s

    [ 0 0 5 8 ] The e x p r e s s i o n can be r e w r i t t e n a s t h e

    minimum

    u n i o n o f

    t h r e e t e r m s c o m p r i s e d s o l e l y

    o f

    i n n e r o i n s , W h i c h

    i s t h e j o i n - d i s j u n c t i v e f o r m o f t h e o r i g i n a l

    SPOJ

    e x p r e s s i o n .

    [ 0 0 5 9 ]

    As l l u s t r a t e d b y t h e

    e x a m p l e ,

    a n SPOJ e x p r e s s i o n

    E ver a s e t of a b l e s

    U

    an be

    converted

    t o a normal form

    c o n s i s t i n g o f t h e

    minimum u n i o n

    o f t e r m s

    composed

    f r o m

    s e l e c t i o n s and i n n e r j o i n s ( b u t no

    o u t e r j o i n s ) .

    More f o r

    m a l ly , t h e j o i n - d i s j u n c t i v e

    n o r m a l

    form

    o f E c a n b e

    r e p r e

    s e n t e d a s

    t h e f o l lo W i n g ,

    Where

    c c p r o j e c t s

    t h e

    r e s u l t o n t o

    t h e d e s i r e d columns C nd

    e a c h t e r m

    E i

    i s

    o f

    t h e

    form

    T i l , T i 2 . . .

    T i m

    i s

    a

    s u b s e t of

    h e

    t a b l e s i n U. P r e d i c a t e p i i s

    t h e

    c o n j u n c t i o n

    o f

    a s u b s e t

    o f

    t h e

    s e l e c t i o n a n d j o i n

    p r e d i c a t e s

    f o u n d i n t h e o r i g i n a l

    form

    o f t h e

    q u e r y .

    [ 0 0 6 0 ] The f o l l o W i n g t r a n s f o r m a t i o n

    r u l e s a r e

    u s e d

    f o r

    c o n v e r t i n g SPOJ e x p r e s s i o n t o

    j o i n - d i s j u n c t i v e

    f o r m .

    i f p ( l ) r e f e r e n c e s

    o n l y

    T 1

    [ 0 0 6 1 ] R u l e ( 4 ) f o l l o W s

    f r o m t h e o b s e r v a t i o n

    t h a t a l l

    t u p l e s o r i g i n a t i n g f r o m t h e t e r m T 2 i n ( T l > < 1 p T 2 o T 2 ) W i l l b e

    n u l l - e x t e n d e d on l l

    columns

    o f T 1 . A l l t h o s e

    t u p l e s

    W i l l b e

    d i s c a r d e d i f p ( l ) i s s t r o n g o n

    T 1 . R u l e

    ( 5 ) f o l l o W s f r o m t h e

    r u l e

    o p ( ' l ) ( T l > 4 p T 2 ) = ( O ' p ( l ) T l ) ) q p T 2

    b y

    e x p a n d i n g t h e

    t W o

    o u t e r j o i n s .

    [ 0 0 6 2 ] The

    o l l o W i n g

    e x a m p l e i l l u s t r a t e s c o n v e r s i o n o f

    a n

    SPOJ

    e x p r e s s i o n u s i n g t h e a b o v e r u l e s .

    p ( i , j )

    d e n o t e s a

    p r e d i c a t e

    t h a t r e f e r e n c e s c o l u m n s

    i n

    t a b l e s

    T i

    a n d T i .

    b y R u l e ( 1 )

    ( ( U ' M U T I ) p ( l , 2 ) T 2 ) ) ' \ ] ; f : i 2 , 3 ) T 3

    b y R u l e

    ( 4 )

    ( T 1 ) 5 p m

    mom

    I i i w n

    b y i n c l u d i n g s e l e c t i o n

    p r e d i c a t e

    i n

    j o i n

    ( T 1 l p u u p u m T z q p m l m ' b y R u l e

    ( 2 )

    ( T l / i i p ( 1 > r p ( 1 . 2 > T 2 ) 6 T 3

  • 8/11/2019 Maintenance of Materialized

    19/30

    US

    007/0192283 A 1

    [ 0 0 6 3 ]

    Each t e r m

    i n

    t h e

    j o i n - d i s j u n c t i v e form o f

    a

    SPOJ

    e x p r e s s i o n

    p r o d u c e s t u p l e s W i t h

    a

    u n i q u e

    n u l l - e x t e n s i o n

    p a t t e r n . S u p p o s e

    t h e c o m p l e t e

    s e t

    o f

    o p e r a n d

    t a b l e s f o r t h e

    e x p r e s s i o n

    i s

    U . A e r m i n t h e j o i n - d i s j u n c t i v e f o r m i s

    de?ned

    v e r a s u b s e t

    S

    o f

    U

    nd

    e n c e ,

    p r o d u c e s

    t u p l e s

    t h a t

    a r e

    n u l l extended on U-S. T he t a b l e s i n s u b s e t S

    a r e

    c a l l e d

    t h e

    terms

    source t a b l e s .

    [ 0 0 6 4 ]

    A

    u p l e

    p r o d u c e d by a t e r m W i t h

    s o u r c e

    t a b l e

    s e t

    S

    c a n

    o n l y

    b e

    s u b s u m e d

    b y t u p l e s p r o d u c e d

    b y t e r m s

    W h o s e

    s o u r c e

    t a b l e

    set

    i s

    a s u p e r s e t of S.

    The

    subsumption r e l a

    t i o n s h i p s among

    t e r m s c a n be

    modeled by

    a DAG

    d i r e c t e d

    a c y c l i c g r a p h ) , Which

    s

    r e f e r r e d

    t o

    a s a s u b s u m p t i o n g r a p h

    o f

    t h e

    SP0]

    e x p r e s s i o n .

    [0065] D e ? n i t i o n . Let E = J 1 C (E16 . . . oEn)

    be

    t h e

    j o i n

    d i s j u n c t i v e f o r m

    o f

    a

    SPOJ

    e x p r e s s i o n .

    The s u b s u m p t i o n

    g r a p h o f E

    c o n t a i n s a

    node i

    f o r

    e a c h t e r m E i i n

    t h e normal

    f o r m ,

    and

    t h e node s

    l a b e l e d

    W i t h t h e s o u r c e

    t a b l e

    s e t S i o f

    E.

    T h e r e

    i s

    an d g e from

    node

    i to

    node

    j ,

    i f S i

    i s

    a

    minimal

    s u p e r s e t o f

    i . S i i s

    a

    m i n i m a l

    s u p e r s e t o f J -

    i f v t h e r e d o e s n o t

    e x i s t a node

    n k

    i n t h e g r a p h s u c h t h a t

    S J - R S k R S 1 .

    [ 0 0 6 6 ] C o n s i d e r t h e f o l l o W i n g e x a m p l e t h a t

    s h o W s t W o

    SPOJ v i e W s , V1 a n d V 2 ,

    t h e i r n o r m a l

    f o r m s . F I G . 3

    i l l u s

    t r a t e s

    s u b s u m p t i o n g r a p h s f o r

    t h e

    e x a m p l e

    SPOJ

    v i e W s

    V 1

    a n d

    V 2 .

    )

    m)

    [ 0 0 6 7 ] T h e m i n i m u m - u n i o n o p e r a t o r s i n t h e j o i n - d i s j u n c

    t i v e normal form have tWo f u n c t i o n s : t o

    e l i m i n a t e subsumed

    t u p l e s a n d

    t o

    t a k e t h e u n i o n o f t h e

    r e m a i n i n g

    t u p l e s .

    By r s t

    e l i m i n a t i n g s u b s u m e d t u p l e s f r o m e v e r y t e r m ,

    t h e minimum

    u n i o n s c a n

    b e

    r e p l a c e d by o u t e r u n i o n s . The

    r e s u l t i n g f o r m

    i s

    u s e f u l

    b e c a u s e i t c l e a rl y shoWs

    What

    e r m s

    a r e a f f e c t e d by

    an u p d a t e and hoW.

    [ 0 0 6 8 ] S u b s u m p t i o n

    among

    t e r m s

    i s

    n o t

    a r b i t r a r y ;

    When

    c h e c k i n g

    W h e t h e r a t u p l e o f a t e r m i s s u b s u m e d ,

    i t

    i s

    s u ? i c i e n t t o

    c h e c k

    a g a i n s t t u p l e s i n p a r e n t t e r m s . The

    f o l l o W i n g

    lemma

    s h o W s

    hoW o

    e l i m i n a t e subsumed

    t u p l e s

    from

    a term.

    [ 0 0 6 9 ]

    Lemma. L e t E i b e a t e r m i n t h e j o i n - d i s j u n c ti v e

    normal form E f a n SPOJ

    x p r e s s i o n .

    Then

    h e

    s e t o f t u p l e s

    g e n e r a t e d b y E i t h a t a re n o t s u b s u m e d b y a n y o t h e r t u p l e s i n

    E can be computed s ,

    Where E l ,

    E 2 ,

    . . . E i m a r e t h e p a r e n t t e r m s of

    i and

    t h e

    j o i n

    p r e d i c a t e q

    s

    a n e q u i j

    o i n o v e r

    c o l u m n s f o r m i n g a k e y o f

    E.

    [ 0 0 7 0 ] D i i s c a l l ed t h e n e t c o n t r i b u t i o n o f t e r m E i b e c a u s e

    t h e

    t u p l e s

    o f

    D i a re

    n o t subsumed by

    a n y

    o t h e r t u p l e s , a n d

    t h u s , a p p e a r e x p l i c i t l y i n t h e v i e W r e s u l t . E x a m p l e s o f t h e n e t

    c o n t r i b u t i o n form a r e

    p r o v i d e d i n f r a .

    A u g . 1 6 , 2 0 07

    [ 0 0 7 1 ] Theorem. L e t E be

    a n

    SPOJ

    e x p r e s s i o n

    W i t h n o r

    mal

    form

    c c ( E l o E 2 o

    . . .

    oEn).

    Then

    E16E26

    . .

    6En=D1UD2U

    . .

    UDn

    Where

    a c h

    D i

    i s

    computed from

    i a s

    de?ned

    n

    t h i s

    Lemma.

    [0072] T h e

    form D l

    U . .

    UDn

    s c a l l e d t h e

    n e t - c o n t r i

    b u t i o n ( n o r m a l ) f o r m o f t h e e x p r e s s i o n . T h i s

    f o r m

    i s i m p o r

    t a n t

    because

    t h e r e i s no

    i n t e r a c t i o n among

    e t c o n t r i b u t i o n s

    from d i f f e r e n t t e r m s , W hich

    means

    t h a t

    each term can be

    m a i n t a i n e d

    i n d e p e n d e n t l y from o t h e r t e r m s .

    [ 0 0 7 3 ] R e f e r r i n g noW t o F I G . 4 , t h e r e i s i l l u s t r a t e d a

    m e t h o d o l o g y o f g e n e r a t i n g a s u b s u m p t i o n g r a p h a n d

    n e t

    c o n t r i b u t i o n s o f t e r m s t o t h e v i e W .

    At

    4 0 0 , t h e vieW

    d e ? n i

    t i o n

    i s r e t r i e v e d .

    At 4 0 2 ,

    t h e

    SP0] p a r t o f

    t h e vieW

    e x p r e s

    s i o n i s c o n v e r t e d

    i n t o j o i n - d i s j u n c t i v e

    n o r m a l

    form c o n s i s t

    i n g o f

    t h e minimum

    n i o n

    o f t e r m s composed f i n n e r

    o i n s .

    At

    4 0 4 ,

    a s u b s u m p t i o n g r a p h i s c r e a t e d

    f r o m

    t h e

    n o r m a l

    f o r m , W h i c h e v e a l s t h e s u b s u m p t i o n ( p a r e n t - c h i l d )

    r e l a t i o n

    s h i p s among

    t h e t e r m s . At 4 0 6 , t h e t e r m e x p r e s s i o n s i n t h e

    normal

    form and

    t h e

    s u b s u m p t i o n g r a p h

    a r e

    u s e d

    to c r e a t e

    e x p r e s s i o n s d e ? n i n g

    t h e n e t

    c o n t r i b u t i o n o f e a c h t e r m t o t h e

    v i e W . The

    n e t

    c o n t r i b u t i o n e x p r e s s i o n f o r

    a

    term

    i s

    con

    s t r u c t e d a c c o r d i n g to t h e L emma

    a b o v e . At 4 0 8 ,

    t h e

    e x p r e s

    s i o n

    d e ? n i n g t h e t o t a l n e t c o n t r i b u t i o n i s c o n s t r u c t e d b y

    c o n n e c t i n g

    a l l

    n e t - c o n t r i b u t i o n

    e x p r e s s i o n s

    b y o u t e r

    u n i o n

    o p e r a t o r s .

    [ 0 0 7 4 ] F o l l o W i n g i s a d e s c r i p t i o n o f hoW

    o

    i n c r e m e n t a l l y

    m a i n t a i n

    an SPOJ vieW W hen s i n g l e

    b a s e

    t a b l e i s modi?ed.

    Only

    i n s e r t i o n s o r d e l e t i o n s a r e

    a d d r e s s e s

    h e r e ; an u p d a t e

    can be t r e a t e d a s a d e l e t i o n folloWed by an i n s e r t i o n . T he

    f o c u s

    h e r e i s

    on d e r i v i n g c o r r e c t m a i n t e n a n c e e x p r e s s i o n s

    and

    n o t

    n e c e s s a r i l y t h e

    most e f ? c i e n t

    o n e s .

    More e f ? c i e n t

    e x p r e s s i o n s a r e d e r i v e d i n f r a .

    [ 0 0 7 5 ]

    A

    r s t

    t a s k

    i s

    t o i d e n t i f y

    Which

    t e r m s

    may

    b e

    a f f e c t e d

    by an

    n s e r t i o n o r

    a d e l e t i o n . Consider a vieW V nd

    suppose one of i t s b a s e t a b l e s T i s modi?ed. T h i s m a y

    change t h e n e t c o n t r i b u t i o n of term

    u t

    o n l y i f T

    c c u r s

    i n

    t h e e x p r e s s i o n

    d e ? n i n g D. By

    n s p e c t i o n o f t h e f o r m o f t h e

    e x p r e s s i o n f o r

    D,

    t i s a p p a r e n t

    t h a t

    t h e c h a n g e may f f e c t

    t h e

    r e s u l t

    i n one

    of

    t h r e e

    Ways:

    [ 0 0 7 6 ]

    i n

    T i ;

    1 . D i r e c t l y ,

    Which

    c c u r s i f

    T s among

    h e

    t a b l e s

    [ 0 0 7 7 ]

    2 . I n d i r e c t l y , Which

    c c u r s i f

    T

    s

    n o t

    among

    h e

    t a b l e s i n T i b u t i t i s among t h e s o u r c e t a b l e s of one o r

    more o f i t s

    p a r e n t

    n o d e s

    ( t e r m s ) ; and

    [ 0 0 7 8 ]

    3 . No f f e c t , o t h e r W i s e .

    [ 0 0 7 9 ]

    Based on

    t h i s

    c l a s s i ? c a t i o n

    of

    h o W

    t e r m s

    a r e

    a f f e c t e d ,

    a

    vieW maintenance graph can

    be c r e a t e d , a s

    f o l l o W s .

    [ 0 0 8 0 ] 1 . E l i m i n a t e

    f r o m

    t h e s u b s u m p t i o n

    g r a p h

    a l l

    n o d e s ( t e r m s )

    t h a t

    a re u n a f f e c t e d b y t h e u p d a t e o f T .

    [ 0 0 8 1 ]

    2 . Mark t h e

    n o d e s

    o f

    t h e

    r e d u c e d g r a p h

    by

    D

    r

    I d e p e n d i n g

    on

    W h e t h e r t h e

    node

    ( t e r m ) i s

    a f f e c t e d

    d i r e c t l y

    o r

    i n d i r e c t l y .

    [ 0 0 8 2 ] 3 .

    D r o p a l l

    o u t g o i n g e d g e s f r o m n o d e s

    m a r k e d

    W i t h 1 .

    [ 0 0 8 3 ] F I G . 5 s h o W s t h r e e m a i n t e n a n c e g r a p h s f o r v i e W

    V l t h a t

    a r e

    d e r i v e d

    f r o m t h e

    s u b s u m p t i o n

    g r a p h f o r V I o f

  • 8/11/2019 Maintenance of Materialized

    20/30

    US

    007/0192283 A 1

    FIG. 3. C s a

    member

    f h e source s e t of l l t h r e e

    nodes

    s o

    t h e

    m a i n t e n a n c e g r a p h

    ( a ) f o r

    u p d a t e s

    t o C e t a i n s a l l t h r e e

    n o d e s

    a n d t h e y

    a r e marked

    W i t h

    s u p e r s c r i p t D .

    The

    main

    t e n a n c e

    g r a p h ( b )

    f o r

    u p d a t e s

    t o 0 l s o

    r e t a i n s

    a l l

    t h r e e

    n o d e s .

    0 s

    a

    member

    f

    t h e s o u r c e

    s e t s

    ofnodes

    { C ,

    O ,

    L}

    a n d

    { C ,

    0 } ;

    t h e y

    a r e a f f e c t e d d i r e c t l y a n d m a r k e d W i t h

    s u p e r s c r i p t e d D. O s n o t a member of h e s o u r c e s e t of node

    {C}

    b u t

    i t i s

    a

    member o f

    t h e s o u r c e

    s e t o f i t s p a r e n t ; t h i s

    node

    s

    a f f e c t e d

    i n d i r e c t l y

    and

    marked W i t h

    1 .

    The m a i n t e

    n a n c e g r a p h ( c ) f o r

    u p d a t e s t o

    L e t a i n s

    o n l y

    n o d e s

    { C , O , L }

    a n d

    { C , O } . Node

    { C }

    i s

    d r o p p e d

    b e c a u s e n e i t h e r

    i t

    n o r i t s

    p a r e n t r e f e r e n c e t a b l e

    L .

    [ 0 0 8 4 ] R e f e r r i n g noW t o F I G . 6 , t h e r e i s

    i l l u s t r a t e d

    a

    m e t h o d o l o g y

    o f c o n s t r u c t i n g

    a m a i n t e n a n c e

    g r a p h

    i d e n t i f y

    i n g t e r m s a f f e c t e d b y a n u p d a t e , i n a c c o r d a n c e W i t h t h e

    d i s c l o s e d i n n o v a t i o n . A t 6 0 0 , t h e e x p r e s s i o n d e ? n i n g t h e

    vieW i s r e t r i e v e d . At 6 0 2 , t h e SP0] p a r t o f t h e v i e W

    e x p r e s s i o n i s c o n v e r t e d

    i n t o

    j o i n - d i s j u n c t i v e

    n o r m a l

    f o r m .

    At 6 0 4 , t h e s u b s u m p t i o n g r a p h i s

    c o n s t r u c t e d

    i n t h e manner

    d e s c r i b e d

    e a r l i e r .

    At

    6 0 6 ,

    t e r m s

    u n a f f e c t e d

    by

    t h e

    u p d a t e

    a r e

    e l i m i n a t e d f r o m

    t h e s u b s u m p t i o n g r a p h .

    A t 6 0 8 ,

    e a c h

    r e m a i n i n g n o d e i s

    c l a s s i ? e d

    a n d

    marked

    a c c o r d i n g t o

    Whether i t

    r e p r e s e n t s a d i r e c t l y - a f f e c t e d term o r

    an

    i n d i

    r e c t l y - a l f e c t e d t e r m . A t 6 1 0 , a l l

    o u t g o i n g

    e d g e s a r e d r o p p e d

    from t e r m s marked i n d i r e c t l y

    a f f e c t e d .

    [ 0 0 8 5 ] F o l l o w i n g i s a d e s c r i p t i o n o f

    v i e W

    m a i n t e n a n c e .

    AlV

    s

    u s e d to d e n o t e t h e ( o u t e r ) u n i o n o f a l l c h a n g e s to

    d i r e c t l y

    a f f e c t e d

    t e r m s ,

    and A 2 V to d e n o t e

    t h e same f o r

    i n d i r e c t l y a f f e c t e d

    t e r m s .

    S i m i l a r l y ,

    A I D i

    a n d

    A 2 D i

    d e n o t e

    t h e

    change

    i n t h e n e t c o n t r i b u t i o n D i

    of

    a

    d i r e c t l y

    o r an

    i n d i r e c t l y a f f e c t e d

    t e r m ,

    r e s p e c t i v e l y .

    VieW a i n t e n a n c e

    c a n

    b e

    p e r f o r m e d

    i n t h e

    f o l l o W i n g

    t h r e e s t e p s .

    [ 0 0 8 6 ]

    l .

    The

    a f f e c t e d b a s e

    t a b le

    i s

    u p d a t e d

    ? r s t .

    [ 0 0 8 7 ]

    2 .

    I f

    t h e r e a r e

    no

    d i r e c t l y a f f e c t e d

    t e r m s ,

    We

    r e

    d o n e ; o t h e r W i s e ,

    c o m p u t e

    a n d a p p l y A 1 t o

    t h e

    v i e W .

    [ 0 0 8 8 ] 3 . I f t h e r e a r e no n d i r e c t l y a f f e c t e d

    t e r m s ,

    We r e

    d o n e ; o t h e r W i s e ,

    c o m p u t e

    a n d a p p l y

    A 2 t o t h e

    v i e W .

    [ 0 0 8 9 ]

    A c c o r d i n g l y ,

    F I G .

    7

    i l l u s t r a t e s a m e t h o d o l o g y

    o f

    p e r f o r m i n g vieW m a i n t e n a n c e i n a c c o r d a n c e

    W i t h

    an i n n o

    v a t i v e

    a s p e c t .

    At 7 0 0 ,

    v i e W m a i n t e n a n c e

    i s

    i n i t i a t e d .

    At 7 0 2 ,

    t h e

    a f f e c t e d

    b a s e d t a b l e i s u p d a t e d ? r s t . As a

    s i d e

    e f f e c t o f

    t h i s

    o p e r a t i o n ,

    t h e s e t o f

    i n s e r t e d t u p l e s o r

    t h e

    s e t

    o f

    d e l e t e d

    t u p l e s

    i s

    o b t a i n e d .

    A t 7 0 4 , t h e m a i n t e n a n c e g r a p h i s c h e c k e d

    f o r d i r e c t l y - a f f e c t e d t e r m s . I f no

    such

    terms a r e f o u n d , a t

    7 0 6 , t h e p r o c e s s t e r m i n a t e s .

    I f s u c h

    t e r m s a r e f o u n d , a t 7 0 6 ,

    How s t o

    7 0 8 , Where t h e

    o u t e r

    union o f

    c h a n g e s

    t o t h e n e t

    c o n t r i b u t i o n s

    o f

    d i r e c t l y - a f f e c t e d t e r m s

    i s c o m p u t e d ,

    a n d

    t h e s e a r e a p p l i e d

    t o

    t h e v i e W .

    At

    7 1 0 , t h e

    m a i n t e n a n c e g r a p h

    i s c h e c k e d

    f o r

    i n d i r e c t l y - a f f e c t e d

    t e r m s . A g a i n , a t

    7 1 2 , no

    such t e r m s a r e f o u n d , t h e p r o c e s s t e r m i n a t e s .

    I f

    such t e r m s

    a r e f o u n d , a t 7 1 2 , How

    p r o g r e s s e s

    t o 7 1 4 , Where t h e o u t e r

    u n i o n

    o f c h a n g e s

    t o

    t h e

    n e t

    c o n t r i b u t i o n s

    o f i n d i r e c t l y

    a l f e c t e d

    t e r m s

    i s c o m p u t e d , and t h e s e a r e a p p l i e d to t h e

    view.

    [ 0 0 9 0 ] F o l l o w i n g a r e d e r i v a t i o n s o f m a i n t e n a n c e e x p r e s

    s i o n s

    f o r i n s e r t i o n s

    and

    f o r d e l e t i o n s . F i r s t , c o n s t r u c t

    vieW

    maintenance e x p r e s s i o n s

    f o r

    a vieW V n t h e c a s e o f i n s e r

    t i o n s .

    The s e t

    of

    neW

    oWs

    i n s e r t e d

    i n t o

    a t a b l e

    T s denoted

    b y A T . I f

    E i

    ( D i ) i s a n e x p r e ss i o n , t h e e x p r e s s i o n

    o b t a i n e d

    f r o m

    E i ( D i )

    b y r e p l a c i n g e v e r y o c c u r r e n c e o f

    T

    b y AT

    s

    d e n o t e d

    b y E i A T ( D i A T ) .

    A u g . 1 6 , 2 0 07

    [ 0 0 9 1 ]

    C o n s i d e r t h e

    f o l l o W i n g e x a m p l e . A e t o f

    u p l e s A O

    h a s been i n s e r t e d i n t o t a b l e 0 nd t i s d e s i r e d to m a i n t a i n

    v i e W V 1 .

    F I G .

    5 ( b ) s h o W s t h e m a i n t e n a n c e

    g r a p h f o r

    t h i s

    c a s e .

    T Wo n o d e s

    a re d i r e c t l y a f f e c t e d ,

    n a m e l y

    { C , O , L } a n d

    { C ,

    O } .

    The

    neW

    t u p l e s

    t o

    b e

    i n s e r t e d

    i n t o

    t h e

    v i e W

    c a n b e

    c o m p u t e d b y

    s u b s t i t u t i n g O i t h

    A 0 n t h e e x p r e s s i o n f o r

    t h e n e t c o n t r i b u t i o n o f e a c h t e r m . T h i s g i v e s t h e

    f o l l o W i n g

    A l - e x p r e s s i o n s ,

    [ 0 0 9 2 ] P r e d i c a t e

    q

    o f

    t h e

    a n t i - s e m i j o i n e q u a l s ( l . o k = r . o k )

    W h e r e

    l . o k

    ( r . o k )

    d e s i g n a t e s

    t h e

    column

    ok f r o m t h e

    l e f t

    ( r i g h t ) o p e r a n d o f

    t h e

    j o i n .

    [ 0 0 9 3 ] N e x t , c o n s i d e r t h e i n d i r e c t l y

    a f f e ct e d

    t e r m A

    new

    0

    u p l e may

    o i n

    W i t h

    some C

    t u p l e t h a t p r e v i o u s

    d i d

    n o t

    j o i n

    W i t h

    a n y t h i n g . The

    e r m may

    u r r e n t l y

    c o n t a i n s u c h

    o r p h a n e d C u p l e s ,

    Which must

    noW be d e l e t e d . The vieW

    t u p l e s

    to

    be

    d e l e t e d

    c a n be computed s ,

    =

    ( a

    5 1 5 %

    W h e r e t h e

    j o i n

    p r e d i c a t e q e q u a l s ( l . c k = r . c k ) .

    [ 0 0 9 4 ] C o m b i n i n g t h e p i e c e s , t h e

    f o l l o W i n g c o m p l e t e

    m a i n t e n a n c e e x p r e s s i o n c a n

    be

    o b t a i n e d .

    V 1 ( C , 0 + A 0 , L ) = V I ( C , O , L ) H - J A I D C O L L 1 - J A I D C O

    U A Z D C

    [ 0 0 9 5 ] Lemma. Consider a term

    i n t h e normal

    form of a

    SPOJ i e W Whose n e t co n t r i b u t i o n

    i s

    d e ? n e d b y

    D i = E i l > < 1 q 1 a

    ( E i l U . . . UEim)

    Suppose t a b l e

    T

    h a s been

    updated by

    i n s e r t i n g AT u p l e s . I f t h e

    t e r m

    i s d i r e c t l y affec ted b y

    t h e

    i n s e r t i o n ,

    t h e

    t u p l e s added o

    t h e

    n e t co n t r i b u t i o n

    o f

    t h e t e r m

    can

    be computed

    s ,

    AIDFDQALEQATIXILIla

    ( E H A T L T J

    . . . k - J E i m A T ) .

    I f t h e

    t e r m

    i s i n d i r e c t l y a f f e c t e d , t h e t u p l e s d e l e t e d f r o m t h e

    n e t c o n t r i b u t i o n of t h e term can be computed s ,

    A 2 n i = n i l > < l q l s ( E i l A T h - J

    . H E F J E i

    A T )

    Where q s

    a n

    e q u i j o i n p r e d i c a t e o v e r a u n i q u e k e y o f E.

    [ 0 0 9 6 ]

    T h e

    p r e v i o u s e x a m p l e c o n s i d e r e d

    v i e W V 1

    a n d

    i n s e r t i o n s

    i n t o

    0;

    no W c o n s i d e r

    d e l e t i o n s from 0 . A s

    i n

    t h e

    p r e v i o u s c a s e , t W o t e r m s ar e d i r e c t l y

    a f f e c t e d ,

    n a m e l y { C , O ,

    L } a n d

    { C , O } ,

    s e e F I G . 5 ( b ) .

    T h e

    A l - e x p r e s s i o n s f o r

    t h e

    d i r e c t l y - a f f e c t e d

    terms

    a r e t h e

    same

    a s f o r i n s e r t i o n

    but noW

    t h e r e s u l t i n g t u p l e s a r e

    d e l e t e d

    from t h e v i e W . T h e r e i s

    one

    i n d i r e c t l y - a f f e c t e d t e r m A

    e l e t e d

    0 u p l e may e

    t h e

    l a s t

    t u p l e t o j o i n

    W i t h

    a C

    u p l e .

    I f s o , i t

    s h o u l d a p p e a r i n t h e

    r e s u l t o f

    t h e

    { C }

    t e r m a f t e r t h e u p d a t e . The t u p l e s t o b e

    i n s e r t e d can

    be computed

    s ,

    W h e r e t h e j o i n p r e d i c a t e q e q u a l s ( l . c k = r . c k ) .

  • 8/11/2019 Maintenance of Materialized

    21/30

  • 8/11/2019 Maintenance of Materialized

    22/30

  • 8/11/2019 Maintenance of Materialized

    23/30

  • 8/11/2019 Maintenance of Materialized

    24/30

  • 8/11/2019 Maintenance of Materialized

    25/30

  • 8/11/2019 Maintenance of Materialized

    26/30

  • 8/11/2019 Maintenance of Materialized

    27/30

  • 8/11/2019 Maintenance of Materialized

    28/30

  • 8/11/2019 Maintenance of Materialized

    29/30

  • 8/11/2019 Maintenance of Materialized

    30/30