Beruflich Dokumente
Kultur Dokumente
AB->C
AB->D
E->D
ABC->D
ABC->E
E->A
E->B
D->A
D->G
ACD->B
ACD->E
- Check for attributes that contain two or more on the LHS and their closure
- Also check for redundancy
Continue and whichever relation has a closure which equals R+ makes it a candidate key
{ (H,E), (H,A,B), (H,B,D), (H,C,D), }
Now we see that D->G violates 3NF as its RHS is a set of non key attributes.
R1(D,G)
R2(A,B,C,D,E,H)
New FDs
AB ->E
D->A
CD->E
E->DCB
- Dependency Preserving
Dependency preserving if F+ = F+
Set of FDs we have collected = set of Fds each of which is preserve in at least one table in S
Z = AB
Intersect Z with the first sub schema
(Z UNION R1) = NULL
Therefore it is not preserved.
- Normalize to BCNF
R1(ABH)
R2(DAG)
R3(BCDE)
AB->CD
E->AB
D->AG
CD->E
- Lossless check
R(ABCDEGH)
AB->CD
E->AB
D->AG
CD->E
A B C D E G H
x x x
x x x
x x x x
A B C D E G H
R1 x x y y z t x
R2 x x x
R3 x x x x
Question 3
1) Recovery of System
If the system crashes at B then a log based recovery should be used. Assuming a system
log is used, a log records everything a transaction does at certain points of time (t0..tx).
SQL maintains a buffer cache to read data pages, and modifications are made to a copy of a
page in the buffer. Modifications arent actually written till a checkpoint occurs. When a
modification is made, the log record is written to a disk.
"
If a crash occurs then we usually redo a transaction before the checkpoint occurs.
2) Crash happens at B
The crash occurs in the middle of transaction 3. Now we have to ensure the atomicity of the
transaction (ACID), and since the transaction is not completed (doesnt reach its end) we
have to roll it back to checkpoint A.
THis can be done via the log file that should be stored at checkpoint A.
"
- Via 2PL, you can lock and unlock operations on a certain element(X)
Transaction 1 Transaction 2 Transaction 3
Write_Lock(X)
Read(X)
Write_Lock(Y)
Read(Y)
Read(X) Write_Lock(Y)
Read(Y)
Write(Y)
Write_Lock(X)