data blocks hybrid oltp and olap on compressed
play

Data Blocks: Hybrid OLTP and OLAP on Compressed Storage using both - PowerPoint PPT Presentation

Data Blocks: Hybrid OLTP and OLAP on Compressed Storage using both Vectorization and Compilation Harald Lang 1 , Tobias Mhlbauer 1 , Florian Funke 2, , Peter Boncz 3, , Thomas Neumann 1 , Alfons Kemper 1 1 Technical University Munich,


  1. Data Blocks: Hybrid OLTP and OLAP on Compressed Storage using both Vectorization and Compilation † Harald Lang 1 , Tobias Mühlbauer 1 , Florian Funke 2, ∗ , Peter Boncz 3, ∗ , Thomas Neumann 1 , Alfons Kemper 1 1 Technical University Munich, 2 Snowflake Computing, 3 Centrum Wiskunde & Informatica † To appear at SIGMOD 2016 . * Work done while at Technical University Munich.

  2. Goals ◮ Primary goal ◮ Reducing the memory-footprint in hybrid OLTP&OLAP database systems ◮ Retaining high query performance and transactional throughput ◮ Secondary goals / future work ◮ Eviting cold data to secondary storage ◮ Reducing costly disk I/O ◮ Out of scope ◮ Hot/cold clustering (see previous work of Funke et al.: “Compacting Transactional Data in Hybrid OLTP&OLAP Databases” )

  3. Compression in Hybrid OLTP&OLAP Database Systems ◮ SAP HANA (existing approach) ◮ Compress entire relations ◮ Updates are performed in an uncompressed write-optimized partition ◮ Implicit hot/cold clustering ◮ Merge partitions ◮ HyPer (our approach) ◮ Split relations in fixed size chunks (e.g., 64 K tuples) ◮ Cold chunks are “frozen” into immutable Data Blocks

  4. Data Blocks ◮ Compressed columnar storage format ◮ Designed for cold data (mostly read) ◮ Immutable and self-contained ◮ Fast scans and fast point-accesses ◮ Novel index-structure to narrow scan ranges OLAP OLTP Hot query mostly point acceses uncompressed pipeline through index; some on cold data Cold compressed Data Blocks

  5. Compression Schemes ◮ Lightweight compression only ◮ Single value, byte-aligned truncation, ordered dictionary ◮ Efficient predicate evaluation , decompression and point-accesses ◮ Optimal compression chosen based on the actual value distribution ◮ Improves compression ratio, amortizes light-weight compression schemes and redundancies caused by block-wise compression Uncompressed Data Blocks truncated (A) keys (B) dictionary (B) truncated (C) A B C A 0 B 0 C 0 chunk 0 chunk 1 A 1 B 1 C 1 ... ... keys (C) truncated (B) dictionary (C) single value (A)

  6. Positional SMAs ◮ Lightweight indexing ◮ Extension of traditional SMAs (min/max-indexes) ◮ Narrow scan ranges in a Data Block compressed Data Block Positional SMA (PSMA) range with σ SARGable potential matches ◮ Supported predicates: ◮ column ◦ constant , where ◦ ∈ { = , is, <, ≤ , ≥ , > } ◮ column between a and b

  7. Positional SMAs - Details ◮ Lookup table where each table entry contains a range with potential matches ◮ For n byte values, the table consists of n × 256 entries ◮ Only the most significant non-zero byte is considered most significant non-zero byte leading tail bytes zero-bytes max # of values sharing an entry ... 00 02 03 E4 256 range entries 1 2 8 256 range entries ... 2 16 [0,3) range: [0,3) ... 2 24 256 range entries ... 0x0200AA 0x0000AE 0x02FA42 ... pos: 0 1 2 3 ... lookup table data

  8. Positional SMAs - Details ◮ Lookup table where each table entry contains a range with potential matches ◮ For n byte values, the table consists of n × 256 entries ◮ Only the most significant non-zero byte is considered most significant non-zero byte leading tail bytes zero-bytes max # of values preferred range sharing an entry achieved by ... 00 02 03 E4 using the delta 256 range entries 1 value – SMAmin 2 8 256 range entries ... 2 16 [0,3) range: [0,3) ... 2 24 256 range entries ... 0x0200AA 0x0000AE 0x02FA42 ... pos: 0 1 2 3 ... lookup table data

  9. Positional SMAs - Example SMA min: 2 probe 7 SMA max: 999 [1,17) 1023 ... 259 ... 255 ... 5 ... 0 delta = 5 (7-min) 5 (leading non-0 byte) [0,6) 00 00 00 05 bytes of delta [16,19) [6,7) probe 998 delta = 996 (998-min) [0,0) lookup table 00 00 03 E4 bytes of delta

  10. Challenge for JIT-compiling Query Engines ◮ HyPer compiles queries just-in-time (JIT) using the LLVM compiler framework ◮ Generated code is data-centric and processes a tuple-at-a-time for (const Chunk& c : relation.chunks) { for (unsigned row=0; row!=c.rows; ++row) { auto attr0 = c.column[0].data[row]; auto attr3 = c.column[3].data[row]; // check scan restrictions if (tuple qualifies) { // code of consuming operator ... } } } ◮ Data Blocks individually determine the best suitable compression scheme for each column on a per-block basis ◮ The variety of physical representations either results in ◮ multiple code paths => exploding compile-time ◮ or interpretation overhead => performance drop at runtime

  11. Vectorization to the Rescue ◮ Vectorization greatly reduces the interpretation overhead ◮ Spezialized vectorized scan functions for each compression scheme ◮ Vectorized scan extracts matching tuples to temporary storage where tuples are consumed by tuple-at-a-time JIT code tuple PSMAs JIT-compiled cold scan tuple-at-a-time query pipeline C push matches vectorized evaluation of A B D tuple-at-a-time single interface A SARGable predicates on D vector compressed data and B unpacking of matches compressed interpreted vectorized scan Data Block on Data Block Index hot tuple-at-a-time scan evaluation of scan predicates vectorized evaluation of A B D A B C D SARGable predicates and uncompressed vector copying of matches chunk A B C D vectors of e.g., 8192 records uncompressed interpreted vectorized scan JIT-compiled tuple-at-a-time scan chunk on uncompressed chunk on uncompressed chunk

  12. Predicate Evaluation using SIMD Instructions Find Initial Matches aligned data unaligned data read offset 11 predicate evaluation data movemask remaining data =154 10 - 255 ... 154 ... 1 0 0 lookup add global scan position 0, 3, 4, 6 and update match vector +11 0, 1, 2, 3, 4, 5, 6, 7 1, 3, 5, 7, 9, 11, 14, 15, 17 precomputed positions table match positions write offset

  13. Predicate Evaluation using SIMD Instructions Additional Restrictions write offset match positions 1, 3, 14,-,-,-,-,-, 17, 18, 20, 21, 25, 26, 29, 31 read offset data gather predicate evaluation - 255 ... 172 ... 1 0 0 movemask lookup =172 10 0, 2, 4, 5 shuffle match vector 0, 1, 2, 3, 4, 5, 6, 7 store precomputed 17, 20, 25, 26,-,-,-,- positions table

  14. Evaluation

  15. Compression Ratio Size of TPC-H , IMDB cast info , and a flight database in HyPer and Vectorwise: IMDB 1 cast info Flights 2 TPC-H SF100 uncompressed CSV 107 GB 1.4 GB 12 GB HyPer 126 GB 1.8 GB 21 GB Vectorwise 105 GB 0.72 GB 11 GB compressed HyPer 66 GB (0.62 × ) 0.50 GB (0.36 × ) 4.2 GB (0.35 × ) Vectorwise 54 GB (0.50 × ) 0.24 GB (0.17 × ) 3.2 GB (0.27 × ) 1 http://www.imdb.com 2 http://stat-computing.org/dataexpo/2009/

  16. Query Performance Runtimes of TPC-H queries (scale factor 100) using different scan types on uncompressed and compressed databases in HyPer and Vectorwise. scan type geometric mean sum HyPer JIT (uncomressed) 0.586s 21.7s Vectorized (uncompressed) 0.583s (1.01 × ) 21.6s + SARG 0.577s (1.02 × ) 21.8s Data Blocks (compressed) 0.555s (1.06 × ) 21.5s + SARG/SMA 0.466s (1.26 × ) 20.3s + PSMA 0.463s (1.27 × ) 20.2s Vectorwise uncompressed storage 2.336s 74.4s compressed storage 2.527s (0.92 × ) 78.5s

  17. Query Performance (cont’d) Speedup of TPC-H Q6 (scale factor 100) on block-wise sorted 3 data (+SORT). 14 speedup over JIT 12 gain by PSMA 10 8 6 4 2 0 JIT VEC Data Blocks +SORT +PSMA (+PSMA) (-PSMA) 3 sorted by l_shipdate

  18. OLTP Performance - Point Access Throughput (in lookups per second) of random point access queries select * from customer where c_custkey = randomCustKey() on TPC-H scale factor 100 with a primary key index on c_custkey . Throughput [lookups/sec] Uncompressed 545,554 Data Blocks 294,291 (0.54 × )

  19. OLTP Performance - TPC-C TPC-C transaction throughput (5 warehouses), old neworder records compressed into Data Blocks: Throughput [Tx/sec] Uncompressed 89,229 Data Blocks 88,699 (0.99 × ) Only read-only TPC-C transactions order status and stock level ; all relations frozen into Data Blocks: Throughput [Tx/sec] Uncompressed 119,889 Data Blocks 109,649 (0.91 × )

  20. Performance of SIMD Predicate Evaluation Speedup of SIMD predicate evaluation of type l ≤ A ≤ r with selectivity 20%: sequential x86 code x86 SSE AVX2 5 speedup over 4 3 2 1 0 8-bit 16-bit 32-bit 64-bit data type bit-width

  21. Performance of SIMD Predicate Evaluation (cont’d) Costs of applying an additional restriction with varying selectivities of the first predicate and the selectivity of the second predicate set to 40%: x86 AVX2 cycles per element 8-bit 16-bit 2 2 1 1 0 0 0 50 100 0 50 100 cycles per element 32-bit 64-bit 2 2 1 1 0 0 0 50 100 0 50 100 selectivity of first predicate [%]

  22. Advantages of Byte-Addressability Predicate Evaluation Cost of evaluating a SARGable predicate of type l ≤ A ≤ r with varying selectivities: Data Blocks Horizontal bit-packing cycles per tuple 12 Horizontal bit-packing + positions table 8 4 0 0 25 50 75 100 selectivity [%] ◮ dom ( A ) = [0 , 2 16 ] ◮ Intentionally, the domain exceeds the 2-byte truncation by one bit ◮ 17-bit codes with bit-packing, 32-bit codes with Data Blocks

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend