Professional Documents
Culture Documents
Final Review + Systems Potpourri: Intro To Database Systems Andy Pavlo
Final Review + Systems Potpourri: Intro To Database Systems Andy Pavlo
Systems Potpourri
ADMINISTRIVIA
FINAL EXAM
Who: You
What: http://cmudb.io/f19-final
When: Monday Dec 9th @ 5:30pm
Where: Porter Hall 100
Why: https://youtu.be/6yOH_FjeSAQ
FINAL EXAM
What to bring:
→ CMU ID
→ One page of handwritten notes (double-sided)
→ Extra Credit Coupon
Optional:
→ Spare change of clothes
→ Food
C O U R S E E VA L S
OFFICE HOURS
Andy's hours:
→ Friday Dec 6th @ 3:30-4:30pm
→ Monday Dec 9th @ 1:30-2:30pm
S T U F F B E F O R E M I D -T E R M
SQL
Buffer Pool Management
Hash Tables
B+Trees
Storage Models
Inter-Query Parallelism
TRANSACTIONS
ACID
Conflict Serializability:
→ How to check?
→ How to ensure?
View Serializability
Recoverable Schedules
Isolation Levels / Anomalies
TRANSACTIONS
Two-Phase Locking
→ Rigorous vs. Non-Rigorous
→ Deadlock Detection & Prevention
TRANSACTIONS
CRASH RECOVERY
D I S T R I B U T E D D ATA B A S E S
System Architectures
Replication
Partitioning Schemes
Two-Phase Commit
26 20
25 19
24 18
18 17
18 17
17 17
12 17
11 16
10 15
10 15
CMU 15-445/645 (Fall 2019)
16
FA C E B O O K S C U B A
FA C E B O O K L O G P I P E L I N E SQL Queries
Application Scuba
Servers Execution Layer
Streaming Platform
Aggregator
Record Aggregator
Batcher Aggregator
Structured
Debug Logs Record
Batcher
Validation Service
Combined Logs
…
Per Category Insert
Leaf Node Counters
Record Leaf Node
Batcher Leaf Node
Columnar
Batch Data
Source: Stavros Harizopoulos
SCUBA ARCHITECTURE
Leaf Nodes:
→ Store columnar data on local SSDs.
→ Leaf nodes may or may not contain data needed for a
query.
→ No indexes. All scanning is done on time ranges.
Aggregator Nodes:
→ Dispatch plan fragments to all its children leaf nodes.
→ Combine the results from children.
→ If a leaf node does not produce results before a timeout,
then they are omitted.
SCUBA ARCHITECTURE
SELECT COUNT(*) FROM events Root
WHERE type = 'crash'
AND time = 'Monday' Query Plan
Fragments
SCUBA ARCHITECTURE
SELECT COUNT(*) FROM events Root
WHERE type = 'crash'
AND time = 'Monday' Query Plan
Fragments
SCUBA ARCHITECTURE
SELECT COUNT(*) FROM events Root
WHERE type = 'crash'
AND time = 'Monday' Query Plan
Fragments
SCUBA ARCHITECTURE
SELECT COUNT(*) FROM events Root
WHERE type = 'crash' 30+40+20=90
AND time = 'Monday'
10+20=30 25+15=40 20
Leaf Node Leaf Node Leaf Node Leaf Node… Leaf Node Leaf Node
…
10 20 25 15 20
CMU 15-445/645 (Fall 2019)
21
FA U LT T O L E R A N C E
MONGODB
P H Y S I C A L D E N O R M A L I Z AT I O N
Customers R1(custId,name,…)
⨝
Orders R2(orderId,custId,…)
⨝
Order Items R3(itemId,orderId,…)
CMU 15-445/645 (Fall 2019)
24
P H Y S I C A L D E N O R M A L I Z AT I O N
Customers Customer
Orders
Orders
Order
Orders Order Item
⋮
Order Item
Order Items
CMU 15-445/645 (Fall 2019)
24
P H Y S I C A L D E N O R M A L I Z AT I O N
QUERY EXECUTION
Multi-document transactions.
CMU 15-445/645 (Fall 2019)
26
DISTRIBUTED ARCHITECTURE
STORAGE ARCHITECTURE
COCKROACHDB
DISTRIBUTED ARCHITECTURE
CONCURRENCY CONTROL
COCKROACHDB OVERVIEW
Id=50
ID:1-100 →Node1
Application ID:101-200 →Node2
ID:201-300 →Node3
COCKROACHDB OVERVIEW
ID:1-100 →Node1
Application ID:101-200 →Node2
ID:201-300 →Node3
Update Id=50
Raft
COCKROACHDB OVERVIEW
Id=150 ID:1-100 →Node1
Application ID:101-200 →Node2
ID:201-300 →Node3
COCKROACHDB OVERVIEW
ID:1-100 →Node1
Application Get Id=150 ID:101-200 →Node2
ID:201-300 →Node3
A N DY ' S C O N C L U D I N G R E M A R K S