Docsity

DBMS Lecture: Uncommitted Update, Inconsistent Analysis, Serial Execution, Slides of Introduction to Database Management Systems

Partial preview of the text

Download DBMS Lecture: Uncommitted Update, Inconsistent Analysis, Serial Execution and more Slides Introduction to Database Management Systems in PDF only on Docsity!

Database

Management

System

Lecture - 44

Uncommitted Update Problem

TIME TA TB BAL

t

1 Read (BAL) ……. 1000

t

2

BAL=BAL+100 …….. 1000

t

3 Write (BAL) …….. 1100

t

4 ……. Read (BAL) 1100

t

5

……. BAL=BAL*1.5 1100

t

6 ……. Write (BAL) 2650

t

7

ROLLBACK ……..?

TIME TA TB

t 1 Read (BAL_A) (5000) ……. t 2 INT = BAS_A * .05 …….. t 3 TOT = TOT + INT …….. t 4 ……. ……. t 5 ……. Read (BAL_A) t 6 ……. BAL_A=BAL_A – 1000 t 7 ……. Write (BAL_A) t 8 ……. Read (BAL_E) (5000) t 9 ……. BAL_E = BAL_E + 1000 t 10 ……. Write (BAL_E) t 11 Read (BAL_E) (6000) …….. t 12 INT = BAS_E * .05 …….. t 13 TOT = TOT + INT …….. Docsity.com

Serial Execution An execution where transaction are executed in a serial Schedule or History For two transactions two serial executions or schedules are possible

Serial Execution Different serial schedules may result in a different final DB state, BUT Serial execution is guaranteed to leave DB in a consistent state None of the three concurrent access problems

Lesson? Serial schedule is guaranteed correct, should we adopt it? NNNNNNo, that will be inefficient, under utilization of the resources Disliked by users

Schedule TA = {Read(X), Write(X), commit} TB = {Read(Y), Read(X), Write(Y), commit}

S

1

= {R

A

(X), W

A

(X), C

A

, R

B

(Y), R

B

(X), W

B

(Y), C

B

S

2

= {R

B

(Y), R

B

(X), W

B

(Y), C

B

, R

A

(X), W

A

(X), C

A

S

3

= {R

B

(Y), R

B

(X), R

A

(X), W

B

(Y), C

B

, W

A

(X), C

A

S

4

= {R

A

(X), R

B

(Y), R

B

(X), W

A

(X), C

A

, W

B

(Y), C

B

Interleaved Schedule Interleaved schedule provides concurrent execution BUT Three problems of concurrent access may be encountered

Serializability An interleaved schedule is serializable if the final state of the schedule is equivalent to a serial schedule OR A schedule where conflicting operations are in a serial order

Serializability Two major approaches Locking Timestamping

Lock Compatibility

TA holds

TB requests

Shared

Exclusive

Shared Exclusive

YES

NO

NO

NO

Database

Management

System

Lecture - 44