SlideShare uma empresa Scribd logo
1 de 78
ByteSlice: Pushing the Envelop of
Main Memory Data Processing
with a New Storage Layout
Ziqiang Feng†, Eric Lo†, Ben Kao‡, Wenjian Xu†
†The Hong Kong Polytechnic University
‡The University of Hong Kong
Background
Analytic
database
Read-most
queries
Main
memory
Column store
Lightweight
compression
Modern
hardware
2
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Year
1999
1999
2000
1999
Database on SIMD
128 bits
32 bits
(Zhou & Ross, SIGMOD’02)
1999 1999 2000 1999
3
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Example: scan using SIMD
Year
1999
1999
2000
1999
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Example: scan using SIMD
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000
2000 2000 2000 2000
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
WHERE 𝑣 = 2000
Example: scan using SIMD
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
SIMD_compare_equal
0 0 1 0
False False True False
000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000
2000 2000 2000 2000
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
WHERE 𝑣 = 2000
Example: scan using SIMD
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
7
SIMD_compare_equal
0 0 1 0
False False True False
000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000
2000 2000 2000 2000
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
WHERE 𝑣 = 2000
Example: scan using SIMD
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
8
4X parallelism
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
Padding
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
Padding
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
Padding
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
Padding
Wasted
memory
bandwidth 
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
SIMD_compare_equal
0 0 1 0
False False True False
000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000
2000 2000 2000 2000
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
14
Padding
Wasted
memory
bandwidth 
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
SIMD_compare_equal
0 0 1 0
False False True False
000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000
2000 2000 2000 2000
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
15
Padding
Wasted
memory
bandwidth 
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
SIMD_compare_equal
0 0 1 0
False False True False
000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000
2000 2000 2000 2000
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
Wasted resource
Year
1999
1999
2000
1999
1999 1999 2000 1999
bus
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
16
Padding
Wasted
memory
bandwidth 
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
Wasted
computation
power 
Bit-packed (Willhalm et al., VLDB’09)
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
17
Year
1999
1999
2000
1999
11111001111
Bit-packed (Willhalm et al., VLDB’09)
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
18
Year
1999
1999
2000
1999
11111001111
No padding
Bit-packed (Willhalm et al., VLDB’09)
bus
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
19
Year
1999
1999
2000
1999
11111001111
No padding
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
Bit-packed (Willhalm et al., VLDB’09)
bus
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
20
Year
1999
1999
2000
1999
11111001111
No padding
Saved
memory
bandwidth 
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
Bit-packed (Willhalm et al., VLDB’09)
bus
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
…
Unpack
(← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ )
21
Year
1999
1999
2000
1999
11111001111
No padding
Saved
memory
bandwidth 
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
Bit-packed (Willhalm et al., VLDB’09)
bus
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
…
Unpack
(← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ )
22
Year
1999
1999
2000
1999
11111001111
No padding
Saved
memory
bandwidth 
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
Unpack
overhead 
Bit-packed (Willhalm et al., VLDB’09)
bus
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
…
Unpack
(← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ )
23
Year
1999
1999
2000
1999
11111001111
No padding
Saved
memory
bandwidth 
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
Unpack
overhead 
Bit-packed (Willhalm et al., VLDB’09)
bus
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999
000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111
1999 1999 2000 1999
…
Unpack
(← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ )
24
Year
1999
1999
2000
1999
11111001111
No padding
Saved
memory
bandwidth 
1999 1999 2000 1999
11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 …
1999 1999 2000 1999Wasted
computation
power 
Unpack
overhead 
VBP and HBP
• Vertical Bit Parallel (VBP)
• Horizontal Bit Parallel (HBP)
(Li & Patel, SIGMOD’13)
25
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
…
…
…
…
…
…
1 1 1 1 1 0 0 1 1 1 11 1 1
26
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
27
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
1 1 1 1 1 0 0 1 1 1 11 1 1
28
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
1 1 1 1 1 0 0 1 1 1 11 1 1
29
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
WHERE 𝑣 = 0
0 0 0 0 0 0 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
30
𝑣 = 0
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
WHERE 𝑣 = 0
0 0 0 0 0 0 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
31
𝑣 = 0
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
WHERE 𝑣 = 0
0 0 0 0 … … … …
False
False
False
False
0 0 0 0 0 0 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
32
𝑣 = 0
(∧ ⋯ ∨ ⋯ ⊕)
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
WHERE 𝑣 = 0
0 0 0 0 … … … …
False
False
False
False
0 0 0 0 0 0 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
33
Early-Stop
𝑣 = 0
(∧ ⋯ ∨ ⋯ ⊕)
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
WHERE 𝑣 = 0
0 0 0 0 … … … …
False
False
False
False
0 0 0 0 0 0 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
34
Early-Stop
Early-stop saves
memory
bandwidth 
𝑣 = 0
(∧ ⋯ ∨ ⋯ ⊕)
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
WHERE 𝑣 = 0
0 0 0 0 … … … …
False
False
False
False
0 0 0 0 0 0 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
35
Early-Stop
Early-stop saves
memory
bandwidth 
𝑣 = 0
(∧ ⋯ ∨ ⋯ ⊕)
No wasted
computation
power 
… … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … …
… … … …
… … … …
… … … …
VBP
Year
1999
1999
2000
1999
bus
1 1 1 1 1 1 … … … …
1 1 1 1 1 1 … … … …
1 1 0 1 1 1 … … … …
…
…
…
…
…
…
1 1 1 1 1 1 … … … …
1999
2000
WHERE 𝑣 = 0
0 0 0 0 … … … …
False
False
False
False
0 0 0 0 0 0 … … … …
1 1 1 1 1 0 0 1 1 1 11 1 1
36
Expensive
lookup 
Early-Stop
Early-stop saves
memory
bandwidth 
𝑣 = 0
(∧ ⋯ ∨ ⋯ ⊕)
No wasted
computation
power 
High lookup cost in VBP
1 1 1 1 … … … …
1 1 1 1 … … … …
1 1 0 1 … … … …
…
…
…
…
…
…
1
1
0
Year
1999
1999
2000
1999
37
High lookup cost in VBP
1 1 1 1 … … … …
1 1 1 1 … … … …
1 1 0 1 … … … …
…
…
…
…
…
…
Lookup =
Given a position ID,
retrieve a column value in integer form.
Used for: projection, aggregation, group-by, etc.
1
1
0
Year
1999
1999
2000
1999
38
High lookup cost in VBP
1 1 1 1 … … … …
1 1 1 1 … … … …
1 1 0 1 … … … …
…
…
…
…
…
…
Lookup =
Given a position ID,
retrieve a column value in integer form.
Used for: projection, aggregation, group-by, etc.
… …
2000
= 2000
1
1
0
Year
1999
1999
2000
1999
39
High lookup cost in VBP
1 1 1 1 … … … …
1 1 1 1 … … … …
1 1 0 1 … … … …
…
…
…
…
…
…
Lookup =
Given a position ID,
retrieve a column value in integer form.
Used for: projection, aggregation, group-by, etc.
… …
2000
= 2000
1
1
0
Year
1999
1999
2000
1999
40
1 1 0
High lookup cost in VBP
1 1 1 1 … … … …
1 1 1 1 … … … …
1 1 0 1 … … … …
…
…
…
…
…
…
Lookup =
Given a position ID,
retrieve a column value in integer form.
Used for: projection, aggregation, group-by, etc.
… …
2000
= 2000
1
1
0
Many
instructions 
(∧ ⋯ ∨ ⋯ ← ⋯ → )
Year
1999
1999
2000
1999
41
1 1 0
11111001111
HBP (Li & Patel, SIGMOD’13)
Year
1999
1999
2000
1999
11111001111
42
11111001111
HBP
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
Year
1999
1999
2000
1999
11111001111
43
11111001111
HBP
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
Year
1999
1999
2000
1999
11111001111
44
Delimiter
11111001111
HBP
bus
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
1999 1999 2000 1999
Year
1999
1999
2000
1999
11111001111
45
Delimiter
11111001111
HBP
bus
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
1999 1999 2000 1999
0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … …
2000 2000 2000 2000 WHERE 𝑣 = 2000
Year
1999
1999
2000
1999
11111001111
46
Delimiter
11111001111
HBP
bus
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
1999 1999 2000 1999
0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … …
2000 2000 2000 2000 WHERE 𝑣 = 2000
0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … …
False False True False
+ − ∧ ∨ → ←
Year
1999
1999
2000
1999
11111001111
47
Delimiter
11111001111
HBP
bus
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
1999 1999 2000 1999
0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … …
2000 2000 2000 2000 WHERE 𝑣 = 2000
0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … …
False False True False
+ − ∧ ∨ → ←
No unpack
overhead 
Year
1999
1999
2000
1999
11111001111
48
Delimiter
11111001111
HBP
bus
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
1999 1999 2000 1999
0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … …
2000 2000 2000 2000 WHERE 𝑣 = 2000
0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … …
False False True False
+ − ∧ ∨ → ←
No unpack
overhead 
No early-stop
like VBP 
Year
1999
1999
2000
1999
11111001111
49
Delimiter
11111001111
HBP
bus
1999 1999 2000 1999
(Li & Patel, SIGMOD’13)
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … …
1999 1999 2000 1999
0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … …
2000 2000 2000 2000 WHERE 𝑣 = 2000
0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … …
False False True False
+ − ∧ ∨ → ←
No unpack
overhead 
No early-stop
like VBP 
Year
1999
1999
2000
1999
11111001111
Wasted
bandwidth for
extra bits 
50
Delimiter
Our contribution
VBP HBP ByteSlice
Scan
Early-stop
  
Lookup
  
51
ByteSlice: the layout
𝐵𝑆1
𝐵𝑆2
Year
1999
1999
2000
1999
11111001 11111111001 111
52
ByteSlice: the layout
𝐵𝑆1
𝐵𝑆2
Year
1999
1999
2000
1999
11111001 11111111001 111
53
11111001
111
ByteSlice: the layout
11111001 11111001 11111010 11111001 … … … … … …
11100000 11100000 00000000 11100000 … … … … … …
𝐵𝑆1
𝐵𝑆2
Year
1999
1999
2000
1999
11111001 11111111001 111
54
ByteSlice: the layout
11111001 11111001 11111010 11111001 … … … … … …
11100000 11100000 00000000 11100000 … … … … … …
1999 2000
𝐵𝑆1
𝐵𝑆2
Year
1999
1999
2000
1999
11111001 11111111001 111
55
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
56
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
57
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
00000000 00000000 00000000 00000000 … … … … … …
WHERE 𝑣 = 0
58
𝑣 = 0
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
00000000 00000000 00000000 00000000 … … … … … …
WHERE 𝑣 = 0
59
𝑣 = 0
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
00000000 00000000 00000000 00000000 … … … … … …
00000000 00000000 00000000 00000000 … … … … … …
False False False False
WHERE 𝑣 = 0
60
𝑣 = 0
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
00000000 00000000 00000000 00000000 … … … … … …
00000000 00000000 00000000 00000000 … … … … … …
False False False False
WHERE 𝑣 = 0
E a r l y - S t o p
61
𝑣 = 0
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
00000000 00000000 00000000 00000000 … … … … … …
00000000 00000000 00000000 00000000 … … … … … …
False False False False
WHERE 𝑣 = 0
E a r l y - S t o p
Early-stop saves
memory
bandwidth 
62
𝑣 = 0
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
00000000 00000000 00000000 00000000 … … … … … …
00000000 00000000 00000000 00000000 … … … … … …
False False False False
WHERE 𝑣 = 0
E a r l y - S t o p
Early-stop saves
memory
bandwidth 
63
𝑣 = 0
No unpack
overhead
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
Year
1999
1999
2000
1999
𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …
ByteSlice: scan
bus
11100000 11100000 00000000 11100000 … … … … … …
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
𝐵𝑆2
00000000 00000000 00000000 00000000 … … … … … …
00000000 00000000 00000000 00000000 … … … … … …
False False False False
WHERE 𝑣 = 0
E a r l y - S t o p
Early-stop saves
memory
bandwidth 
Exploit SIMD
byte-level
instructions
(16X parallelism)
 64
𝑣 = 0
No unpack
overhead
11111001 11111001 11111010 11111001 … … … … … …
11100000 11100000 00000000 11100000 … … … … … …
ByteSlice: lookup
Year
1999
1999
2000
1999
11111001
111
65
11111001 11111001 11111010 11111001 … … … … … …
11100000 11100000 00000000 11100000 … … … … … …
ByteSlice: lookup
Year
1999
1999
2000
1999
11111001
111
1999
= 1999
66
11111001 11111001 11111010 11111001 … … … … … …
11100000 11100000 00000000 11100000 … … … … … …
ByteSlice: lookup
Year
1999
1999
2000
1999
11111001
111
1999
= 1999
67
11111001 111
11111001 11111001 11111010 11111001 … … … … … …
11100000 11100000 00000000 11100000 … … … … … …
ByteSlice: lookup
Year
1999
1999
2000
1999
11111001
111
1999
= 1999
Few
instructions 
68
11111001 111
Experiments
• Setup
• Intel i7 quad-core
• AVX2 SIMD instruction (256 bits)
• Micro-benchmark
• Vary # bits per value
• Vary selectivity
• Vary data skew
• Scale out multicores
• TPC-H 10 GB
• Default and Zipfian
• Real datasets
• Adult
• Baseball
69
3 representative queries
70
Conclusion: ByteSlice
Combine the advantages of state-
of-the-art
Avoid their disadvantages
Efficient scan
Efficient lookup
No tradeoff
71
72
Appendix
73
Alternative:
Storing trailing bits in VBP
• A hybrid of ByteSlice and VBP
Year
1999
1999
2000
1999
11111001 11111111001 111
11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1
1 1 0 1 1 1 … … … …
1 1 0 1 1 1 … … … …
1 1 0 1 1 1 … … … …𝑉1
𝑉2
𝑉3
Padding / Space overhead?
• If value not a multiple of 8 bits, pad 0’s at the end.
• We focus on memory bandwidth, because:
• Adding RAM is easy
• Increasing memory bandwidth is difficult
• Extra RAM space?  Cheap.
• Extra bandwidth?  Early stop helps!
75
How does the # of bits affects?
76
Comparison of Early-stop
Layout Early-stop? # of processed bits per value
Bit-packed X 15
HBP X 16
VBP √ 10.53
ByteSlice √ 8.94
77
TPC-H results
78

Mais conteúdo relacionado

Destaque

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

ByteSlice: Pushing the Envelop of Main Memory Data Processing with a New Storage Layout

  • 1. ByteSlice: Pushing the Envelop of Main Memory Data Processing with a New Storage Layout Ziqiang Feng†, Eric Lo†, Ben Kao‡, Wenjian Xu† †The Hong Kong Polytechnic University ‡The University of Hong Kong
  • 3. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Year 1999 1999 2000 1999 Database on SIMD 128 bits 32 bits (Zhou & Ross, SIGMOD’02) 1999 1999 2000 1999 3
  • 4. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Example: scan using SIMD Year 1999 1999 2000 1999 1999 1999 2000 1999
  • 5. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Example: scan using SIMD Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 6. 000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000 2000 2000 2000 2000 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 WHERE 𝑣 = 2000 Example: scan using SIMD Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 7. SIMD_compare_equal 0 0 1 0 False False True False 000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000 2000 2000 2000 2000 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 WHERE 𝑣 = 2000 Example: scan using SIMD Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 7
  • 8. SIMD_compare_equal 0 0 1 0 False False True False 000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000 2000 2000 2000 2000 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 WHERE 𝑣 = 2000 Example: scan using SIMD Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 8 4X parallelism
  • 9. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 10. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 Padding
  • 11. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 Padding 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 12. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 Padding 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 13. 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 Padding Wasted memory bandwidth  000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 14. SIMD_compare_equal 0 0 1 0 False False True False 000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000 2000 2000 2000 2000 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 14 Padding Wasted memory bandwidth  000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 15. SIMD_compare_equal 0 0 1 0 False False True False 000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000 2000 2000 2000 2000 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 15 Padding Wasted memory bandwidth  000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999
  • 16. SIMD_compare_equal 0 0 1 0 False False True False 000000…11111010000 000000…11111010000 000000…11111010000 000000…11111010000 2000 2000 2000 2000 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 Wasted resource Year 1999 1999 2000 1999 1999 1999 2000 1999 bus 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 16 Padding Wasted memory bandwidth  000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 Wasted computation power 
  • 17. Bit-packed (Willhalm et al., VLDB’09) 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 17 Year 1999 1999 2000 1999 11111001111
  • 18. Bit-packed (Willhalm et al., VLDB’09) 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 18 Year 1999 1999 2000 1999 11111001111 No padding
  • 19. Bit-packed (Willhalm et al., VLDB’09) bus 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 19 Year 1999 1999 2000 1999 11111001111 No padding 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999
  • 20. Bit-packed (Willhalm et al., VLDB’09) bus 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 20 Year 1999 1999 2000 1999 11111001111 No padding Saved memory bandwidth  1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999
  • 21. Bit-packed (Willhalm et al., VLDB’09) bus 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 … Unpack (← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ ) 21 Year 1999 1999 2000 1999 11111001111 No padding Saved memory bandwidth  1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999
  • 22. Bit-packed (Willhalm et al., VLDB’09) bus 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 … Unpack (← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ ) 22 Year 1999 1999 2000 1999 11111001111 No padding Saved memory bandwidth  1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 Unpack overhead 
  • 23. Bit-packed (Willhalm et al., VLDB’09) bus 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 … Unpack (← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ ) 23 Year 1999 1999 2000 1999 11111001111 No padding Saved memory bandwidth  1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 Unpack overhead 
  • 24. Bit-packed (Willhalm et al., VLDB’09) bus 1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999 000000…11111001111 000000…11111001111 000000…11111010000 000000…11111001111 1999 1999 2000 1999 … Unpack (← ⋯ → ⋯ ∧ ⋯ ∨ ⋯ ) 24 Year 1999 1999 2000 1999 11111001111 No padding Saved memory bandwidth  1999 1999 2000 1999 11111001111 11111001111 11111010000 11111001111 …11111001111 11111001111 11111010000 11111001111 … 1999 1999 2000 1999Wasted computation power  Unpack overhead 
  • 25. VBP and HBP • Vertical Bit Parallel (VBP) • Horizontal Bit Parallel (HBP) (Li & Patel, SIGMOD’13) 25
  • 26. … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 … … … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 26
  • 27. … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 27
  • 28. … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 1 1 1 1 1 0 0 1 1 1 11 1 1 28
  • 29. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 1 1 1 1 1 0 0 1 1 1 11 1 1 29
  • 30. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 WHERE 𝑣 = 0 0 0 0 0 0 0 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 30 𝑣 = 0
  • 31. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 WHERE 𝑣 = 0 0 0 0 0 0 0 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 31 𝑣 = 0
  • 32. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 WHERE 𝑣 = 0 0 0 0 0 … … … … False False False False 0 0 0 0 0 0 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 32 𝑣 = 0 (∧ ⋯ ∨ ⋯ ⊕)
  • 33. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 WHERE 𝑣 = 0 0 0 0 0 … … … … False False False False 0 0 0 0 0 0 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 33 Early-Stop 𝑣 = 0 (∧ ⋯ ∨ ⋯ ⊕)
  • 34. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 WHERE 𝑣 = 0 0 0 0 0 … … … … False False False False 0 0 0 0 0 0 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 34 Early-Stop Early-stop saves memory bandwidth  𝑣 = 0 (∧ ⋯ ∨ ⋯ ⊕)
  • 35. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 WHERE 𝑣 = 0 0 0 0 0 … … … … False False False False 0 0 0 0 0 0 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 35 Early-Stop Early-stop saves memory bandwidth  𝑣 = 0 (∧ ⋯ ∨ ⋯ ⊕) No wasted computation power 
  • 36. … … … …1 1 1 1 1 1 … … … …1 1 1 1 1 1 … … … … … … … … … … … … … … … … VBP Year 1999 1999 2000 1999 bus 1 1 1 1 1 1 … … … … 1 1 1 1 1 1 … … … … 1 1 0 1 1 1 … … … … … … … … … … 1 1 1 1 1 1 … … … … 1999 2000 WHERE 𝑣 = 0 0 0 0 0 … … … … False False False False 0 0 0 0 0 0 … … … … 1 1 1 1 1 0 0 1 1 1 11 1 1 36 Expensive lookup  Early-Stop Early-stop saves memory bandwidth  𝑣 = 0 (∧ ⋯ ∨ ⋯ ⊕) No wasted computation power 
  • 37. High lookup cost in VBP 1 1 1 1 … … … … 1 1 1 1 … … … … 1 1 0 1 … … … … … … … … … … 1 1 0 Year 1999 1999 2000 1999 37
  • 38. High lookup cost in VBP 1 1 1 1 … … … … 1 1 1 1 … … … … 1 1 0 1 … … … … … … … … … … Lookup = Given a position ID, retrieve a column value in integer form. Used for: projection, aggregation, group-by, etc. 1 1 0 Year 1999 1999 2000 1999 38
  • 39. High lookup cost in VBP 1 1 1 1 … … … … 1 1 1 1 … … … … 1 1 0 1 … … … … … … … … … … Lookup = Given a position ID, retrieve a column value in integer form. Used for: projection, aggregation, group-by, etc. … … 2000 = 2000 1 1 0 Year 1999 1999 2000 1999 39
  • 40. High lookup cost in VBP 1 1 1 1 … … … … 1 1 1 1 … … … … 1 1 0 1 … … … … … … … … … … Lookup = Given a position ID, retrieve a column value in integer form. Used for: projection, aggregation, group-by, etc. … … 2000 = 2000 1 1 0 Year 1999 1999 2000 1999 40 1 1 0
  • 41. High lookup cost in VBP 1 1 1 1 … … … … 1 1 1 1 … … … … 1 1 0 1 … … … … … … … … … … Lookup = Given a position ID, retrieve a column value in integer form. Used for: projection, aggregation, group-by, etc. … … 2000 = 2000 1 1 0 Many instructions  (∧ ⋯ ∨ ⋯ ← ⋯ → ) Year 1999 1999 2000 1999 41 1 1 0
  • 42. 11111001111 HBP (Li & Patel, SIGMOD’13) Year 1999 1999 2000 1999 11111001111 42
  • 43. 11111001111 HBP 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … Year 1999 1999 2000 1999 11111001111 43
  • 44. 11111001111 HBP 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … Year 1999 1999 2000 1999 11111001111 44 Delimiter
  • 45. 11111001111 HBP bus 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 1999 1999 2000 1999 Year 1999 1999 2000 1999 11111001111 45 Delimiter
  • 46. 11111001111 HBP bus 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 1999 1999 2000 1999 0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … … 2000 2000 2000 2000 WHERE 𝑣 = 2000 Year 1999 1999 2000 1999 11111001111 46 Delimiter
  • 47. 11111001111 HBP bus 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 1999 1999 2000 1999 0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … … 2000 2000 2000 2000 WHERE 𝑣 = 2000 0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … … False False True False + − ∧ ∨ → ← Year 1999 1999 2000 1999 11111001111 47 Delimiter
  • 48. 11111001111 HBP bus 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 1999 1999 2000 1999 0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … … 2000 2000 2000 2000 WHERE 𝑣 = 2000 0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … … False False True False + − ∧ ∨ → ← No unpack overhead  Year 1999 1999 2000 1999 11111001111 48 Delimiter
  • 49. 11111001111 HBP bus 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 1999 1999 2000 1999 0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … … 2000 2000 2000 2000 WHERE 𝑣 = 2000 0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … … False False True False + − ∧ ∨ → ← No unpack overhead  No early-stop like VBP  Year 1999 1999 2000 1999 11111001111 49 Delimiter
  • 50. 11111001111 HBP bus 1999 1999 2000 1999 (Li & Patel, SIGMOD’13) 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 0 11111001111 0 11111001111 0 11111010000 0 11111001111 … … … … … … 1999 1999 2000 1999 0 11111010000 0 11111010000 0 11111010000 0 11111010000 … … … … … … 2000 2000 2000 2000 WHERE 𝑣 = 2000 0 00000000000 0 00000000000 1 00000000000 0 00000000000 … … … … … … False False True False + − ∧ ∨ → ← No unpack overhead  No early-stop like VBP  Year 1999 1999 2000 1999 11111001111 Wasted bandwidth for extra bits  50 Delimiter
  • 51. Our contribution VBP HBP ByteSlice Scan Early-stop    Lookup    51
  • 54. ByteSlice: the layout 11111001 11111001 11111010 11111001 … … … … … … 11100000 11100000 00000000 11100000 … … … … … … 𝐵𝑆1 𝐵𝑆2 Year 1999 1999 2000 1999 11111001 11111111001 111 54
  • 55. ByteSlice: the layout 11111001 11111001 11111010 11111001 … … … … … … 11100000 11100000 00000000 11100000 … … … … … … 1999 2000 𝐵𝑆1 𝐵𝑆2 Year 1999 1999 2000 1999 11111001 11111111001 111 55
  • 56. Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 56
  • 57. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 57
  • 58. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 00000000 00000000 00000000 00000000 … … … … … … WHERE 𝑣 = 0 58 𝑣 = 0
  • 59. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 00000000 00000000 00000000 00000000 … … … … … … WHERE 𝑣 = 0 59 𝑣 = 0
  • 60. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 00000000 00000000 00000000 00000000 … … … … … … 00000000 00000000 00000000 00000000 … … … … … … False False False False WHERE 𝑣 = 0 60 𝑣 = 0
  • 61. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 00000000 00000000 00000000 00000000 … … … … … … 00000000 00000000 00000000 00000000 … … … … … … False False False False WHERE 𝑣 = 0 E a r l y - S t o p 61 𝑣 = 0
  • 62. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 00000000 00000000 00000000 00000000 … … … … … … 00000000 00000000 00000000 00000000 … … … … … … False False False False WHERE 𝑣 = 0 E a r l y - S t o p Early-stop saves memory bandwidth  62 𝑣 = 0
  • 63. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 00000000 00000000 00000000 00000000 … … … … … … 00000000 00000000 00000000 00000000 … … … … … … False False False False WHERE 𝑣 = 0 E a r l y - S t o p Early-stop saves memory bandwidth  63 𝑣 = 0 No unpack overhead
  • 64. 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … …11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 Year 1999 1999 2000 1999 𝐵𝑆1 11111001 11111001 11111010 11111001 … … … … … … ByteSlice: scan bus 11100000 11100000 00000000 11100000 … … … … … … 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 𝐵𝑆2 00000000 00000000 00000000 00000000 … … … … … … 00000000 00000000 00000000 00000000 … … … … … … False False False False WHERE 𝑣 = 0 E a r l y - S t o p Early-stop saves memory bandwidth  Exploit SIMD byte-level instructions (16X parallelism)  64 𝑣 = 0 No unpack overhead
  • 65. 11111001 11111001 11111010 11111001 … … … … … … 11100000 11100000 00000000 11100000 … … … … … … ByteSlice: lookup Year 1999 1999 2000 1999 11111001 111 65
  • 66. 11111001 11111001 11111010 11111001 … … … … … … 11100000 11100000 00000000 11100000 … … … … … … ByteSlice: lookup Year 1999 1999 2000 1999 11111001 111 1999 = 1999 66
  • 67. 11111001 11111001 11111010 11111001 … … … … … … 11100000 11100000 00000000 11100000 … … … … … … ByteSlice: lookup Year 1999 1999 2000 1999 11111001 111 1999 = 1999 67 11111001 111
  • 68. 11111001 11111001 11111010 11111001 … … … … … … 11100000 11100000 00000000 11100000 … … … … … … ByteSlice: lookup Year 1999 1999 2000 1999 11111001 111 1999 = 1999 Few instructions  68 11111001 111
  • 69. Experiments • Setup • Intel i7 quad-core • AVX2 SIMD instruction (256 bits) • Micro-benchmark • Vary # bits per value • Vary selectivity • Vary data skew • Scale out multicores • TPC-H 10 GB • Default and Zipfian • Real datasets • Adult • Baseball 69
  • 71. Conclusion: ByteSlice Combine the advantages of state- of-the-art Avoid their disadvantages Efficient scan Efficient lookup No tradeoff 71
  • 72. 72
  • 74. Alternative: Storing trailing bits in VBP • A hybrid of ByteSlice and VBP Year 1999 1999 2000 1999 11111001 11111111001 111 11111001 11111001 11111010 11111001 … … … … … …𝐵𝑆1 1 1 0 1 1 1 … … … … 1 1 0 1 1 1 … … … … 1 1 0 1 1 1 … … … …𝑉1 𝑉2 𝑉3
  • 75. Padding / Space overhead? • If value not a multiple of 8 bits, pad 0’s at the end. • We focus on memory bandwidth, because: • Adding RAM is easy • Increasing memory bandwidth is difficult • Extra RAM space?  Cheap. • Extra bandwidth?  Early stop helps! 75
  • 76. How does the # of bits affects? 76
  • 77. Comparison of Early-stop Layout Early-stop? # of processed bits per value Bit-packed X 15 HBP X 16 VBP √ 10.53 ByteSlice √ 8.94 77