March 25, 2019
... but first ...
Rank | Group | Time (s) | ||
---|---|---|---|---|
1 | Group1 | 0.88 | ||
2 | theMasterMINDS | 0.89 | ||
3 | Dumbledore's Army | 0.93 | ||
4 | cnn_is_fake_news | 0.95 |
Rank | Group | Time (s) | ||
---|---|---|---|---|
1 | Group1 | 0.51 | ||
2 | theMasterMINDS | 0.61 | ||
3 | cnn_is_fake_news | 0.65 | ||
4 | Dumbledore's Army | 0.67 | ||
5 | Administrators | 0.71 | ||
6 | Megalodons | 0.86 | ||
7 | Chwilio | 0.91 |
Rank | Group | Time (s) | ||
---|---|---|---|---|
1 | Root | 3.49 | ||
2 | Group1 | 4.65 | ||
3 | theMasterMINDS | 4.87 | ||
4 | cnn_is_fake_news | 5.27 | ||
5 | Megalodons | 6.03 | ||
6 | Sentinels | 7.03 | ||
7 | Lannisters | 7.57 | ||
8 | Netflix and Chill | 7.61 | ||
9 | Dumbledore's Army | 8.27 | ||
10 | Chwilio | 9.24 | ||
11 | Data for Dayz | 9.95 |
Rank | Group | Time (s) | ||
---|---|---|---|---|
1 | Root | 4.48 | ||
2 | theMasterMINDS | 5.28 | ||
3 | cnn_is_fake_news | 5.58 | ||
4 | Group1 | 5.68 | ||
5 | Megalodons | 5.97 | ||
6 | Sentinels | 7.02 | ||
7 | Lannisters | 7.67 | ||
8 | Dumbledore's Army | 8.00 | ||
9 | Netflix and Chill | 8.82 | ||
10 | Chwilio | 9.33 |
CREATE VIEW salesSinceLastMonth AS
SELECT l.*
FROM lineitem l, orders o
WHERE l.orderkey = o.orderkey
AND o.orderdate > DATE(NOW() - '1 Month')
SELECT partkey FROM salesSinceLastMonth
ORDER BY shipdate DESC LIMIT 10;
SELECT suppkey, COUNT(*)
FROM salesSinceLastMonth
GROUP BY suppkey;
SELECT partkey, COUNT(*)
FROM salesSinceLastMonth
GROUP BY partkey;
Opportunity: Views exist to be queried frequently
Idea: Pre-compute and save the view’s contents!
(like an index)
When the base data changes,
the view needs to be updated too!
Our view starts off initialized
Idea: Recompute the view from scratch when data changes.
Not quite facepalm-worthy, but not ideal.
ΔQ | (ideally) Small & fast query |
+ | (ideally) Fast "merge" operation |
Insertions
Deletions
Updates
A Set/Bag of Insertions
+
A Set/Bag of Deletions
R | + | ΔR |
---|---|---|
A Set/Bag | "+" | A Set/Bag of Insertions A Set/Bag of Deletions |
R | ∪/⊎
− |
ΔRins
ΔRdel |
... this feels a bit wrong (+ is not "closed")
(but that's a topic for 662)
VIEW←VIEW+ΔQ(D,ΔD)
Given Q(R,S,…)
Construct ΔQ(R,ΔR,S,ΔS,…)
σ(R)→σ(R⊎ΔR)
≡ σ(R) ⊎ σ(ΔR)
Q(D)=σ(R)
ΔQ(D,ΔD)=σ(ΔR)
Set/Bag difference also commutes through selection
π(R)→π(R⊎ΔR)
≡ π(R) ⊎ π(ΔR)
Q(D)=π(R)
ΔQ(D,ΔD)=π(ΔR)
Does this work under set semantics?
R1⊎R2→R1⊎ΔR1⊎R2⊎ΔR2
≡ R1⊎R2 ⊎ ΔR1⊎ΔR2
Q(D)=R1⊎R2
ΔQ(D,ΔD)=ΔR1⊎ΔR2
So far: ΔQins(D,ΔD)=Q(ΔQins) ΔQdel(D,ΔD)=Q(ΔQdel)
... but what if R and S both change