Why are learned indexes so effective?
Paolo Ferragina1 Fabrizio Lillo2 Giorgio Vinciguerra1
1University of Pisa 2University of Bologna
Why are learned indexes so effective? Paolo Fabrizio Giorgio - - PowerPoint PPT Presentation
Why are learned indexes so effective? Paolo Fabrizio Giorgio Ferragina 1 Lillo 2 Vinciguerra 1 1 University of Pisa 2 University of Bologna A classical problem in computer science Given a set of sorted input keys (e.g. integers)
Paolo Ferragina1 Fabrizio Lillo2 Giorgio Vinciguerra1
1University of Pisa 2University of Bologna
engines, IP lookup in routersβ¦
2
ππππππ 36 = True ππ ππππππ‘π‘ππ 50 = 48
2 11 13 15 18 23 24 29 31 34 36 44 47 48 55 59 60 71 73 74 76 88 95
1 π
3
2 11 13 15 18 23 24 29 31 34 36 44 47 48 55 59 60 71 73 74 76 88 95
1 π πππ‘ππ’πππ πππ§
B-tree
4 positions keys
2 11 13 15 18 23 24 29 31 34 36 44 47 48 55 59 60 71 73 74 76 88 95
1 π
5 positions keys
2 11 13 15 18 23 24 29 31 34 36 44 47 48 55 59 60 71 73 74 76 88 95
1 π 2 3 4
2 11 13 15 1 2 3 4
6
πππ‘ππ’πππ πππ§ Black-box trained on a dataset of pairs (key, pos) π = { 2,1 , 11,2 , β¦ , (95, π)} Binary search in πππ‘ππ’πππ β π, πππ‘ππ’πππ + π (approximate)
positions keys
2 11 13 15 18 23 24 29 31 34 36 44 47 48 55 59 60 71 73 74 76 88 95
1 π e.g. π is of the order of 100β1000
7
vs
vs
8
https://pgm.di.unipi.it
positions keys
1 3 8 11 12 19 22 23 24 28 29 33 38 47 48 53 55 56 57
πππ‘ β π, πππ‘ + π
24 8
8
[Ferragina and Vinciguerra, PVLDB 2020]
9
positions keys positions keys positions keys
π! π" βͺ π!
finite mean π and variance π$
10
positions keys
π( π) π* π+
1 2 3 4 5 π" π# π$ π% π&
πΏ = π$ π$ π$ and the number of segments on a dataset of size π is π πΏ with high probability.
11
12
(note that π is of the order of 100-1000)
parallel lines at distance π
13
Start a new segment from here
positions keys
π π
3. A discrete-time random walk, iid increments with mean π 4. Compute the expectation of πβ = min π β β πI, π is outside the red strip i.e. the Mean Exit Time (MET) of the random walk 5. Show that the slope π = 1/π maximises πΉ[πβ], giving πΉ[πβ] = πJ/πJ πJ
14
positions keys
π π
Start a new segment from here
(πππ§!β, πβ)
random walker location time
Start a new segment from here
πβ
π π π π
I. The length of a segment found by the algorithm that computes the smallest PLA, adopted in the PGM-index II. The exit time of the random walk
15
16
250 50 100 150 200 250 Ξ΅ Pareto k = 3, Ξ± = 3
OPT MET Thm 1 (3.0Ξ΅2)
0.5 1 1.5 Mean segment length Β·106 Lognormal Β΅ = 1, Ο = 0.5
OPT MET Thm 1 (3.521Ξ΅2)
250 50 100 150 200 250 Ξ΅
More distributions in the paper
OPT = Average segment length in a PGM-index MET = Mean exit time of the random walk
Both OPT and MET agree on the slope 1/Β΅, but OPT is more robust
50 100 150 200 250 0.1 0.2 Ξ΅ Relative error Ο/Β΅ = 0.15
Pareto k = 10, Ξ± = 7.741 Gamma ΞΈ = 5, k = 44.444 Lognormal Β΅ = 2, Ο = 0.149 44.444Ξ΅2
50 100 150 200 250 0.2 0.4 0.6 0.8 Ξ΅ Ο/Β΅ = 1.5
Pareto k = 10, Ξ± = 2.202 Gamma ΞΈ = 5, k = 0.444 Lognormal Β΅ = 2, Ο = 1.086 0.444Ξ΅2
50 100 150 200 250 0.5 1 Ξ΅ Ο/Β΅ = 15
Pareto k = 10, Ξ± = 2.002 Gamma ΞΈ = 5, k = 0.004 Lognormal Β΅ = 2, Ο = 2.328 0.004Ξ΅2
17
1. Do the results still hold without the iid assumption on the gaps? 2. Is the segment found by the optimal algorithm adopted in the PGM-index a constant factor longer than the one found by the random walker?
18