Cviceni 1
ACID
Atomicity
Consistency
Isolation
Durability
Stavovy diagram transakce
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Active |
|
|
Parcial commit |
|
|
Commit |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Failed |
|
|
Abort |
|
|
|
|
|
|
|
|
|
|
|
Anomalie
fantom - T1 precte mnozinu radku, T2 prida radek, pri dalsi operaci T1 pribyl radek, ktery nebyl v prechozich operacich
neopakovatelne cteni - T1 precte podruhe stejnou promennou, ta uz ma ale jinou hodnotu
docasna aktualizace (cteni nepotvrzenych dat) - T1 zapise bez commit, T2 precte, T1 da rollback
RU - read uncommit
RC - read commit
RR - reapeted read
S - serializable
| RU | RC | RR | S |
Fantom | | | | X |
Neopak. cteni | | | X | X |
Doc. akt. | | X | X | X |
Deadlock
Uzamykaci protokol
Relace
Relacni algebra
Schema
Armstrongova pravidla
trivialni vztahy XY→X XY→Y X→X
tranzitivita X→Y a Y→Z doubleright X→Z
kompozice prave strany
dekompozice X→Y X→Z ekvivalence X→YZ
Funkcni zavislost
Uzaver mnoziny atributu
Klic
Priklad:
R(a,b,c,d,e,f) F={f->ab, f->e, a->f}
fc+={a,b,c,e,f}
klic=fcd,acd
R(a,b,c,d,e,f,g) F(c->de,a->c,e->a,d->b,f->g)
klic=cf,af,ef
1NF atomicita atribut
2NF neex. podklic →neklic, vsechny atrib zavisi na celem klici
3NF neex. neklic → neklic, neklicovy atribut nemuze byt zavisly na klici tranzitivne
BCNF neex. podklic → podklic
Priklady
Priklad:
R(<b>a</b>,<b>b</b>,c,d,e) IO:{b->c,d->e}
F(ab->c,ab->d,ab->e)
R1(<b>b</b>,c)
R21(<b>a</b>,<b>b</b>,d)
R2(<b>d</b>,e)
R(a,b,c,d,e,f,g) F(c->de,a->c,e->a,d->b,f->g) TODO
R1(a,f)
R2(a,c)
R3(f,g)
R4(c,d,e)
R5(d,b)
Operace
Selekce R(fi)
Projekce R[c]
Kart. soucin RxS
Rozdil R\S
Prirozene spojeni R*S (leve R<*S, prave S*>R)
Prejmenovani R[t→x]
Sjednoceni R union S
Theta -spojeni R[t1 theta t2]S
Antijoin overline{R<*S} R\(R<*S)
Vnejsi spojeni R *_LR S = (R *_L S) union (R *_R S) … (R *_L S_ (R*S) union (R\(R<*S))x(NULL,..)