Depth Estimation for Ranking Query Optimization
KarlSchnaitter,UCSantaCruz JoshuaSpiegel,BEASystems,Inc. NeoklisPolyzotis,UCSantaCruz
Depth Estimation for Ranking Query Optimization - - PowerPoint PPT Presentation
Depth Estimation for Ranking Query Optimization KarlSchnaitter,UCSantaCruz JoshuaSpiegel,BEASystems,Inc. NeoklisPolyzotis,UCSantaCruz Relational Ranking Queries SELECT h.hid, r.rid, e.eid FROM Hotels h,
KarlSchnaitter,UCSantaCruz JoshuaSpiegel,BEASystems,Inc. NeoklisPolyzotis,UCSantaCruz
2
(,,)=0.3* +0.5* +0.2*
Inthiscase, =10
RANK BY 0.3/h.price + 0.5*r.rating + 0.2*isMusic(e) LIMIT 10 (e) = isMusic(e) Events: (r) = r.rating Restaurants: (h) = 1/h.price Hotels: SELECT h.hid, r.rid, e.eid FROM Hotels h, Restaurants r, Events e WHERE h.city = r.city AND r.city = e.city
3
SELECT h.hid, r.rid, e.eid FROM Hotels h, Restaurants r, Events e WHERE h.city = r.city AND r.city = e.city RANK BY 0.3/h.price + 0.5*r.rating + 0.2*isMusic(e) LIMIT 10
by score
Rank join Rank join Join Join
4
5
6
7
8
9
x f(x)
10
0.3/h.price+0.5*r.rating+0.2*isMusic(e)
0.3*1 +0.5*r.rating+0.2*1
11
0.8 y 1.0 x bL a L 0.7 w 0.9 z 1.0 y bR a R Query: Top result from L R with scoring function S(bL, bR) = bL + bR Result: y Score: 1.8
Bound: 1.8 Bound: 1.7
12
bL a L bR a R
Bound: 2.0 Bound: 2.0 1.8 1.9 1.7
x 1.0 y 0.8 y 1.0 z 0.9 w 0.7 Result: y Score: 1.8 Query: Top result from L R with scoring function S(bL, bR) = bL + bR
13
14
15
defined in terms of
defined in terms of
16
1.0 0.5 0.7 0.7 0.7 bR 6 4 3 2 2 FL
R(bL,bR)
1.0 1.0 1.0 0.9 0.6 bL 5 2 3 12 8 "(") 1.0 0.9 0.8 0.6 0.4 " 3 1 2 () 1.0 0.7 0.5
FL FL R
17
– #():Returnfrequencyof – (,):Returnnextlowestscoreondimension
#()=3 (,1)=0.9 (,2)=0.5
1.0 0.5 0.7 0.7 0.7 bR 6 4 3 2 2 FL R(bL,bR) 1.0 1.0 1.0 0.9 0.6 bL
18
19
2 2 1 1
1 2
l2 r2 r1 l1 s2 s1 Score of the kth best tuple out of s1 1. Depths of needed to output score of s1 l1 and r1 2. Score of the l1
th best
tuple out of s2 3. Depths of needed to output score of s2 l2 and r2 4.
20
sum FL R(bL,bR) bL + bR 6 9 11 1.0 0.5 0.7 0.7 0.7 bR 6 4 3 2 2 FL
R(bL,bR)
1.0 1.0 1.0 0.9 0.6 bL 6 3 2 4 2 2.0 1.7 1.6 1.5 1.3 term =1.6
21
1 0.7 0.5 6 4 1 0.9 0.8 0.6 3 2 2
1.0 0.5 0.7 0.7 0.7 bR 6 4 3 2 2 FL
R(bL,bR)
1.0 1.0 1.0 0.9 0.6 bL
– Avoidsmaterializingcompletetable
– Moreefficientinpractice
term =1.6
22
2 2 1 1
1 2
l2 r2 r1 l1 s2 s1 Score of the kth best tuple out of s1 1. Depths of needed to output score of s1 l1 and r1 2. Score of the l1
th best
tuple out of s2 3. Depths of needed to output score of s2 l2 and r2 4.
23
11≤ depth≤ 15 5 2 3 12 8 "(") 1.0 0.9 0.8 0.6 0.4 "
<Sterm < Sterm <Sterm <Sterm <Sterm =Sterm = Sterm =Sterm >Sterm > Sterm > Sterm >Sterm Input Score Bounds
– Accessvia# and – Similartoestimationof term
5 2 3 4 8 "(") 2.0 1.9 1.8 1.6 1.4 " + 1
24
25
26
27
342% 3% 12% 2% 18% 16% 44% 39% 489% 501% 297%
1 10 100 1000 0.5 1 1.5 z DEEP Probabilistic Sampling
Zipfian Skew Parameter Percentage Error
28
697% 683% 696% 679% 284% 695% 644% 28% 28% 28% 28% 28% 25% 35%
1 10 100 1000 10000 1 2 3 4 5 6 7 Input DEEP Sampling
Input of Two-Join Query
Percentage Error
29
30
31
depth? depth? selectivity = k depth = |L| selectivity? depth = |R|
Selectivity Estimation Depth Estimation
32
33