24
These slides are for use with Database Systems Concepts, Languages and Architectures Paolo Atzeni • Stefano Ceri • Stefano Paraboschi • Riccardo Torlone © McGraw-Hill 1999 To view these slides on-screen or with a projector use the arrow keys to move to the next or previous slide. The return or enter key will also take you to the next slide. Note you can press the ‘escape’ key to reveal the menu bar and then use the standard Acrobat controls — including the magnifying glass to zoom in on details. To print these slides on acetates for projection use the escape key to reveal the menu and choose ‘print’ from the ‘file’ menu. If the slides are too large for your printer then select ‘shrink to fit’ in the print dialogue box. Press the ‘return’ or ‘enter’ key to continue . . .

Concepts, Languages and Architecturesdbbook.dia.uniroma3.it/Chap09.pdfVSR Taxonomy of the classes of schedule accepted by the methods VSR, CSR, 2PL and TS. Database Systems Chapter

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

  • These slides are for use with

    Database SystemsConcepts, Languages and Architectures

    Paolo Atzeni • Stefano Ceri • Stefano Paraboschi • Riccardo Torlone© McGraw-Hill 1999

    To view these slides on-screen or with a projector use the arrow keys tomove to the next or previous slide. The return or enter key will also takeyou to the next slide. Note you can press the ‘escape’ key to reveal themenu bar and then use the standard Acrobat controls — including themagnifying glass to zoom in on details.

    To print these slides on acetates for projection use the escape key toreveal the menu and choose ‘print’ from the ‘file’ menu. If the slides aretoo large for your printer then select ‘shrink to fit’ in the print dialoguebox.

    Press the ‘return’ or ‘enter’ key to continue . . .

  • Chapter 9

    Technologyof a databaseserver

    ??????????Click herefor help

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    Architecture of the concurrency control system

    Scheduler

    read(X) write(Y) read(Z)

    Database

    XY

    Z

    YZ

    X Z,X

    Y Main memorybuffer

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    S10 w0(x) r1(x) r1(z)w0(z) r2(x) r3(z) w3(z) w1(x)

    S11 w0(x) w0(z) r1(x)r2(x) r1(z) w1(x) r3(z) w3(z)

    t0

    t2t1

    t3

    A schedule S10

    conflict-equivalent to a serialschedule S

    11

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    t

    Resourcerequested growing phase

    shrinking phase

    Representation of allocated resources for 2PL

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    CSR

    2PLTS

    VSR

    Taxonomy of the classes of schedule accepted bythe methods VSR, CSR, 2PL and TS

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    t1 t2

    t5

    t3 t4

    Conflict graph for a schedule

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    DB

    Tab 1 Tab 2 Tab n

    Fragment 1 Fragment 2 Fragment n

    Tuple 1 Tuple 2 Tuple n

    Field 1 Field 2 Field n

    The hierarchy of resources

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    flush

    Scheduler

    BufferManager

    File System

    create, deleteextend

    open, close

    read,read_seq

    Database Management System

    write,write_seq

    Database

    YZ

    X

    Mainmemorybuffer

    YX Z

    fix use unfix force

    Architecture of the buffer manager

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    unfix

    fix use unfix begin commit abort

    BufferManager

    flush

    Database Management System

    write,write_seq

    read,read_seqY

    Z

    X

    Database

    Log

    X ZY

    fix use force (for db and log)

    Mainmemorybuffer

    Reliabilitycontrol system

    Restartprocedure

    Warmrestart

    Coldrestart

    Architecture of the reliability control system

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    DumpCheckpointCheckpoint

    t

    Transaction record t1

    Top ofthe log

    B U U C

    Description of a log

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    W(X) W(Y)

    W(Y)W(Y)

    W(Y)

    W(X)

    t

    t

    t

    (c)

    (a)

    (b)

    Write in log

    Write in database

    W(X)

    B(T) U(T,X,BS,AS) U(T,Y,BS,AS) C

    B(T) U(T,X,BS,AS) U(T,Y,BS,AS) C

    B(T) U(T,X,BS,AS) U(T,Y,BS,AS) C

    Protocols for the joint writing of log and database

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    Fail

    Stop

    Fail

    Boot

    Recovery

    Normalfunctionality

    End ofrecovery

    Fail-stop model of the functioning of a DBMS

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    fix

    Buffer Manager

    Recovery Manager

    ...........

    DBMS

    Query plans

    Scanmgr

    B+treemgr

    Sortmgr

    Hashmgr

    use unfix

    Access methods manager

    Architecture of the access manager

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    stack stack

    tuple tuple tuple

    page dictionary useful part of the pagechecksum

    access method control information

    file system control information

    t3 t2 t1*t3*t2*t1

    Organization of tuples within pages

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    Sub-tree that containskeys K < K1

    P0 K1 P1 PjKj KF PF. . . . . . . . . .

    Sub-tree that containskeys Kj ≤ K< Kj+1

    Sub-tree that containskeys K ≥ KF

    Information contained in a node (page) of a B+ tree

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    b. delete k2: merge

    a. insert k3: split

    initial situation

    k1 k6

    k1 k2 k4 k5

    k1 k3 k6

    k1 k2 k3 k4 k5

    k1 k6

    k3 k4 k5k1

    Split and merge operations on a B+ tree structure

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    Second level

    Root node

    First level

    Pointers to data (arbitrarily organized)

    Peter

    Mavis Rick

    Mavis Peter Rick TracyBabs David

    Example of B+ tree

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    k1 k6 k10

    k2 k3 k4 k5 k7 k8 k9

    t(k2) t(k3) t(k4) t(k5) t(k1) t(k6) t(k10) t(k7) t(k8) t(k9)

    Example of a B tree

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    Query

    Dependencies

    CatalogueLexical, syntactic and

    semantic analysis

    Algebraicoptimization

    Cost-basedoptimization Profiles

    Queryplan

    Compilation of a query

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    JA JA

    a

    a ---------------

    ---------------- a ---------------

    a ---------------

    Internal tableExternal tableexternalscan

    internal scanor indexedaccess

    Join technique with nested-loop

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    A

    abbccefh

    A

    aabceegh

    -------------------------------- ---------------

    Left table Right table

    leftscan

    rightscan

    Join technique with merge scan

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    J

    deac

    jj

    emaa

    jz

    Left table Right table

    J

    J

    hash(a) hash(a)

    a

    A A

    Join technique with hashing

  • Database SystemsChapter 9: Technology of a database server

    © McGraw-Hill 1999

    (S T) R

    R S T

    (R S(R T

    1 1 1 1

    2 2 2 2

    1 2T)

    21

    21S)

    1 2

    nested-loopR internal

    nested-loopR external

    merge-scan hash-join

    nested-loopT internal

    nested-loopT external

    merge-scan hash-join

    strategy 1 strategy 2 strategy 3 strategy 4

    Execution options in a conjunctive query