





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






2/15/ 05 1
2/15/ 05 2
1.A M odelforConcurrency Control 2.Serializability Theory 3.Synchronization Requirem ents forRecoverability 4.Tw o-Phase Locking 5.Im plem enting Tw o-Phase Locking 6.Locking Perform ance 7.M ultigranularity Locking (revisited) 8.H otSpotTechniques 9.Q uery-U pdate Techniques 10.Phantom s 11.Shared D isk System s 12.B-Trees 13.Tree locking
2/15/ 05 3
2/15/ 05 4
SelectFoo.A From Foo (U PD LO CK) W here Foo.B = 7
2/15/ 05 5
Throughput
Low
H igh
Low H igh
thrashing
2/15/ 05 6
2
2/15/ 05 7
A voiding Thrashing
2/15/ 05 8
Interesting Sidelights
2/15/ 05 9
H ow to Reduce Lock Contention
Start Lock L Com m it t
Reducing Lock Contention (cont’d)
Part# Price O nH and Part# PartN am eCatalogPage
2/15/ 05 11
M athem aticalM odelofLocking
2/15/ 05 12
8.7 M ultigranularity Locking (M G L)
4
2/15/ 05 19
D elaying O perations U ntilCom m it
2/15/ 05 20
Locking H igher-LevelO perations
r w inc dec r y n n n w n n n n inc n n y y dec n n y y
2/15/ 05 21
Solving the Threshold Problem A notherIM S FastPath Technique
bEnough = Verify(iQuantity, n); If (bEnough) Decrement(iQuantity, n) else print (“not enough”); 2/15/ 05 22
O ptim istic Concurrency Control
2/15/ 05 23
Batching
2/15/ 05 24
Partitioning
5
2/15/ 05 25
8.9 Q uery-U pdate Techniques
2/15/ 05 26
D ata W arehouse
2/15/ 05 27
D egrees ofIsolation
D egrees ofIsolation (cont’d)
2/15/ 05 29
A N SISQ L Isolation Levels
2/15/ 05 30
M S SQ L Server
7
2/15/ 05 37
8.10 Phantom s
T 1 :Read A ccounts 1,2,and 3 T 2 :InsertA ccounts[4,Tacom a,100] T 2 :Read A ssets(Tacom a),returns 500 T 2 :W rite A ssets(Tacom a,600) T 1 :Read A ssets(Tacom a),returns 600 T 1 :Com m it
A cct# Location Balance Location Total 1 Seattle 400 2 Tacom a 200 3 Tacom a 300
Seattle 400 Tacom a 500
A ccounts A ssets
The phantom record
2/15/ 05 38
The Phantom Phantom Problem
2/15/ 05 39
A voiding Phantom s -Predicate Locks
2/15/ 05 40
Precision Locks
2/15/ 05 41
8.11 Shared D isk System s
Process A
P r 2
Process B
P
r 7
2/15/ 05 42
Shared D isk System
8
2/15/ 05 43
Logging
2/15/ 05 44
8.12 B-Trees
2/15/ 05 45
B-Tree Structure
2/15/ 05 46
Exam ple n= 127 496
2/15/ 05 47
Insertion
19 - -
12 14 17
To insertkey 15 •splitthe leaf •splitthe parent’s range [0,19) to [0,15)and [15,19) •ifthe parentw asfull,you’d splitthattoo (notshow n here) •this autom atically keeps the tree balanced
2/15/ 05 48
B-Tree O bservations