Relaxed Currency and Consistency: How to Say “Good Enough” in SQL
description
Transcript of Relaxed Currency and Consistency: How to Say “Good Enough” in SQL
![Page 1: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/1.jpg)
Relaxed Currency and Consistency:
How to Say “Good Enough” in SQL
H. Guo, P. Larson, R. Ramakrishnan, J. Goldstein
Presented by Mike Nie
![Page 2: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/2.jpg)
Background-1
•Using asynchronous copies technique is common because they are good for:
•scalability
•performance
•availability
![Page 3: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/3.jpg)
Background-II
•The way asynchronous copies technique works:
• Replicate data over a number of database systems
• User interact with replicas to balance the workload of the entire system
• Data update over the entire system is not in the same scope the transactions; the system will propagate the update later for the purpose of better respond time
![Page 4: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/4.jpg)
Motivation
•Currently there is NO way for user to express “freshness” in SQL.
•Database system can’t respond well because queries are not explicit, even though it can easily keep track how current its data is.
![Page 5: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/5.jpg)
Currency and Consistency
•Currency: how fresh the data is in replica database system
•Consistency: whether or not two replica tables correspond to the same snapshot
•e.g. book_copy and review_copy
![Page 6: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/6.jpg)
C & C Syntax in SQL
•A C & C Clause occurs last in SFW block and follow the same scoping rule as the Where clause
•New clause can reference tables defined in current and outer SFW blocks
![Page 7: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/7.jpg)
Single-Block Query
![Page 8: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/8.jpg)
Multi-Block Query
![Page 9: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/9.jpg)
Implementation-I•Integrate C & C in MTCache
![Page 10: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/10.jpg)
Implementation-II
•Normalizing C&C Constraints
•Transform C&C clause to a set of tuples, e.g. C = {<b1,S1>,<b2,S2>,...,<bn,Sn>}
•Compile-Time Consistency Checking
•Integrate consistency checking into SQL optimizer
![Page 11: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/11.jpg)
Implentation-III•Compile-time consistency
checking(cont.)
• e.g. checking if Reserves and Sailors belong to the same mutually consistent group.
![Page 12: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/12.jpg)
Implementation-IV• Run-time currency Checking
•whether exist a copy in locate that is satisfy currency bound
• choose plan based on cost
![Page 13: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/13.jpg)
Experiments
•Query Optimization Experiments
•Workload Distribution
•Overhead of Currency Guards
![Page 14: Relaxed Currency and Consistency: How to Say “Good Enough” in SQL](https://reader034.fdocuments.us/reader034/viewer/2022051821/56815874550346895dc5d2d6/html5/thumbnails/14.jpg)
Conclusion
•Given such an explicit syntax user can specify C&C constraints in SQL
•System can respond well given such an explicit requirement
•Questions and Comments