Notes09 - CS245:DatabaseSystem Principles...

Info icon This preview shows pages 1–18. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 245 Notes 09 1 CS 245: Database System  Principles Notes 09: Concurrency Control Hector Garcia-Molina
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 2 Chapter 18 [18]  Concurrency Control    T1 T2 Tn DB (consistency constraints)
Image of page 2
CS 245 Notes 09 3 Example: T1: Read(A) T2: Read(A)  A+100  A × 2 Write(A) Write(A) Read(B) Read(B)  B+100 B × 2 Write(B) Write(B) Constraint:  A=B
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 4 Schedule A T1 T2 Read(A); A   A+100 Write(A); Read(B); B    B+100; Write(B); Read(A);A    A × 2; Write(A);      Read(B);B    B × 2; Write(B);
Image of page 4
CS 245 Notes 09 5 Schedule A T1 T2 Read(A); A   A+100 Write(A); Read(B); B    B+100; Write(B); Read(A);A    A × 2; Write(A);      Read(B);B    B × 2; Write(B); A B 25 25 125 125 250 250 250 250
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 6 Schedule B T1 T2 Read(A);A    A × 2; Write(A); Read(B);B    B × 2; Write(B); Read(A); A   A+100 Write(A); Read(B); B    B+100; Write(B);
Image of page 6
CS 245 Notes 09 7 Schedule B T1 T2 Read(A);A    A × 2; Write(A); Read(B);B    B × 2; Write(B); Read(A); A   A+100 Write(A); Read(B); B    B+100; Write(B); A B 25 25 50 50 150 150 150 150
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 8 Schedule C T1 T2 Read(A); A   A+100 Write(A); Read(A);A    A × 2; Write(A); Read(B); B    B+100; Write(B);      Read(B);B    B × 2; Write(B);
Image of page 8
CS 245 Notes 09 9 Schedule C T1 T2 Read(A); A   A+100 Write(A); Read(A);A    A × 2; Write(A); Read(B); B    B+100; Write(B);      Read(B);B    B × 2; Write(B); A B 25 25 125 250 125 250 250 250
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 10 Schedule D T1 T2 Read(A); A   A+100 Write(A); Read(A);A    A × 2; Write(A);      Read(B);B    B × 2; Write(B); Read(B); B    B+100; Write(B);
Image of page 10
CS 245 Notes 09 11 Schedule D T1 T2 Read(A); A   A+100 Write(A); Read(A);A    A × 2; Write(A);      Read(B);B    B × 2; Write(B); Read(B); B    B+100; Write(B); A B 25 25 125 250 50 150 250 150
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 12 Schedule E T1 T2’ Read(A); A   A+100 Write(A); Read(A);A    A × 1; Write(A);      Read(B);B    B × 1; Write(B); Read(B); B    B+100; Write(B); Same as Schedule D but with new T2’
Image of page 12
CS 245 Notes 09 13 Schedule E T1 T2’ Read(A); A   A+100 Write(A); Read(A);A    A × 1; Write(A);      Read(B);B    B × 1; Write(B); Read(B); B    B+100; Write(B); A B 25 25 125 125 25 125 125 125 Same as Schedule D but with new T2’
Image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 14 Want schedules that are “good”, regardless of initial state and transaction semantics Only look at order of read and writes Example:  Sc=r 1 (A)w 1 (A)r 2 (A)w 2 (A)r 1 (B)w 1 (B)r 2 (B)w 2 (B)
Image of page 14
CS 245 Notes 09 15 Sc’=r 1 (A)w 1 (A) r 1 (B)w 1 (B)r 2 (A)w 2 (A)r 2 (B)w 2 (B)      T 1          T 2 Example:  Sc=r 1 (A)w 1 (A)r 2 (A)w 2 (A)r 1 (B)w 1 (B)r 2 (B)w 2 (B)
Image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 245 Notes 09 16 However, for Sd: Sd=r 1 (A)w 1 (A)r 2 (A)w 2 (A) r 2 (B)w 2 (B)r 1 (B)w 1 (B) as a matter of fact,        T must precede T         in any equivalent schedule,         i.e.,  T 2    T 1
Image of page 16
CS 245 Notes 09 17 T 1     T 2
Image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 18
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern