Unit4 Dbms PDF
Unit4 Dbms PDF
Content (CO4)
• Basic Assumption
– Each transaction preserves database consistency.
– Thus serial execution of a set of transactions preserves
database consistency.
– A (possibly concurrent) schedule is serializable if it is
equivalent to a serial schedule.
Schedule 3 Schedule 6
Checking Whether a Schedule is Conflict
Content
Serializable Or Not (CO4)
Problem-01:
Check whether the given schedule S is conflict serializable or not-
S : R1(A) , R2(A) , R1(B) , R2(B) , R3(B) , W1(A) , W2(B)
Solution-
Step-01:
List all the conflicting operations and determine the
dependency between the transactions-
R2(A) , W1(A) (T2 → T1)
R1(B) , W2(B) (T1 → T2)
R3(B) , W2(B) (T3 → T2)
DailyContent
Quiz (CO4)
• Step-02:
• Draw the precedence graph-
1. T1 → T3 → T4 → T2
2. T1 → T4 → T3 → T2
3. T4 → T1 → T3 → T2
View Serializability
Content (CO4)
Thumb Rules
All conflict serializable schedules are view serializable.
All view serializable schedules may or may not be conflict
serializable.
Checking Whether a Schedule is View
Content
Serializable Or Not (CO4)
Method-02:
• Check if there exists any blind write operation.
Writing without reading is called as a blind write
If there does not exist any blind write, then the schedule
is surely not view serializable.
If there exists any blind write, then the schedule may or
may not be view serializable. Go and check using other
methods.
Thumb Rule
No blind write means not a view serializable schedule.
Checking Whether a Schedule is View
Content
Serializable Or Not (CO4)
Method-03:
in this method, try finding a view equivalent serial schedule.
By using the above three conditions, write all the
dependencies.
Then, draw a graph using those dependencies.
If there exists no cycle in the graph, then the schedule is view
serializable otherwise not.
PROBLEMS BASED ONContent
VIEW SERIALIZABILITY (CO4)
Problem-01
Check whether the given schedule S is view serializable or not-
PROBLEMS BASED ONContent
VIEW SERIALIZABILITY (CO4)
Solution-
• Checking Whether S is Conflict Serializable Or Not-
• Step-01:
List all the conflicting operations and determine the
dependency between the transactions-
– W1(B) , W2(B) (T1 → T2)
– W1(B) , W3(B) (T1 → T3)
– W1(B) , W4(B) (T1 → T4)
– W2(B) , W3(B) (T2 → T3)
– W2(B) , W4(B) (T2 → T4)
– W3(B) , W4(B) (T3 → T4)
• Step-02:
– Draw the precedence graph-
– Clearly, there exists no cycle in the precedence graph.
– Therefore, the given schedule S is conflict serializable.
Schedule = w3(x),r2(x),w2(y),r1(z),w3(y),w1(y)
Note:
Non-serializable schedules-
• may or may not be consistent
• may or may not be recoverable
RecoverableContent
schedule (CO4)
Example :
S1: R1(x), W1(x), R2(x), R1(y), R2(y), W2(x), W1(y), C1, C2;
Irrecoverable schedule (CO4)
Content
• If in a schedule,
A transaction performs a dirty read operation from an
uncommitted transaction
(Reading from an uncommitted transaction is called
as a dirty read)
And commits before the transaction from which it has
read the value
then such a schedule is known as an Irrecoverable
Schedule.
• The following schedule is not recoverable if T9 commits
immediately after the read
Irrecoverable schedule (CO4)
Content
<T0 start>
<T0, A, 1000, 950>
To, B, 2000, 2050
A = 950
B = 2050
<T0 commit>
<T1 start>
<T1, C, 700, 600>
C = 600
BB, BC
<T1 commit>
BA
• Note: BX denotes block containing X.
Immediate DB Modification
Content Recovery Example
(Cont.) (CO4)
Below we show the log as it appears at three instances of time.
Tc Tf
T1
T2
T3
T4
Distributed Database
Management System
Centralized Databases
Content (CO4)
Advantages
Data are located near “greatest demand” site
Faster data access
Faster data processing
Growth facilitation
Improved communications
Reduced operating costs
User-friendly interface
Less danger of a single-point failure
Processor independence
DDBMS Disadvantages
Content
Replication
System maintains multiple copies of data, stored in
different sites, for faster retrieval and fault tolerance.
Fragmentation
Relation is partitioned into several fragments stored
in distinct sites
Replication and fragmentation can be combined
Relation is partitioned into several fragments: system
maintains several identical replicas of each such
fragment.
Distributed Transactions
Content