TL;DR
This paper introduces a novel framework for accelerating SQL analytics by performing queries directly on compressed data within a GPU. By leveraging PyTorch tensor primitives and specialized parallel algorithms for encodings like Run-Length Encoding (RLE), the authors achieve order-of-magnitude speedups and enable GPUs to process datasets significantly larger than their onboard memory capacity.
What Problem Does This Paper Address?
Modern GPUs are computational powerhouses, but they are frequently hamstrung by the "Memory Wall." While a high-end GPU like the NVIDIA A100 has incredibly fast High Bandwidth Memory (HBM), it typically only has 40–80 GB—a fraction of the terabytes available to CPUs.
When a dataset exceeds this limit, systems usually resort to "brute-force" scaling (more GPUs), slow data streaming over PCIe, or falling back to the CPU. Data compression seems like an obvious fix, but traditional systems pay a "decompression tax": they must decompress data into its full size before processing it, which wastes both time and precious HBM. The challenge addressed here is how to execute complex relational algebra (joins, aggregations, filters) directly on the compressed "encoded" format without ever fully expanding it.
Methods
The authors built their system on top of the Tensor Query Processor (TQP), which translates SQL into programs composed of PyTorch tensor operations. This is a clever "hack": by using ML-optimized primitives like bucketize, scatter, and repeat_interleave, they gain portability across different GPU hardwares without writing custom CUDA kernels.
Key technical contributions include:
- Lightweight Encodings: Support for RLE (storing values as
[value, start, end]), Index encoding (for sparse data), and bit-width reduction. - Composite Encodings: A "Plain + Index" approach that stores most data in narrow bit-widths (e.g., int8) while handling outliers separately via Index encoding.
- Parallel Primitives: The "secret sauce" is a set of new algorithms for operations like
range_intersect. This allows the system to perform anANDoperation or a join between two different RLE columns even if their "runs" (the sequences of repeated values) don't align perfectly. - Alignment Technique: A method to synchronize disparate compressed columns so that point-wise arithmetic (like
ColA + ColB) can be performed on the compressed segments themselves.
Datasets
The researchers evaluated their framework across three distinct categories:
- TPC-H: The industry-standard decision support benchmark, tested at Scale Factors (SF) 50, 100, and 300.
- Production Dataset: A massive, real-world Microsoft dataset featuring a star schema with a 2.94 billion row fact table.
- Public BI Datasets: 34 diverse datasets from Tableau Public, representing a wide variety of real-world data distributions and "messy" user-generated content.
Key Insights and Ideas
- PyTorch as a Database Engine: The most surprising insight is that PyTorch—a library designed for neural networks—is remarkably efficient for relational algebra. Its vectorized operations allow for high GPU utilization without the need for explicit loops or conditional branches that typically slow down GPU kernels.
- Computing on Runs, Not Rows: By operating on RLE "runs," the system's complexity becomes proportional to the number of runs rather than the number of rows. If a column has 1 billion rows but only 1,000 runs, a
SUMoperation becomes nearly instantaneous. - The Power of Sorting: The authors demonstrate that "Query-Specific Data Ordering" (sorting tables based on the columns used in filters) can reduce the number of RLE runs from 105 million down to just 3, drastically improving both compression and speed.
- Avoiding the "Decompression Tax": By keeping data compressed throughout the entire query pipeline, they reduce I/O overhead and peak memory usage simultaneously.
Key Results
- Massive Speedups: On the TPC-H benchmark, the compressed GPU execution was up to 23.8x faster than uncompressed GPU execution and over 10x faster than state-of-the-art commercial CPU-only systems (like SQL Server).
- Memory Efficiency: The system reduced peak memory usage by up to 3.7x. This allowed a 120 GB dataset (in "Plain" format) to fit and run on a single 80 GB A100 GPU by compressing it to roughly 56 GB.
- Scalability: On the production dataset, the system successfully processed 6.52 billion rows—222% of the original size—within the same GPU memory footprint where the uncompressed version failed at only 50% capacity.
Limitations and Future Work
- Heavyweight Formats: The system currently does not support "heavy" compression like Snappy, Zstd, or LZ4, which require more complex decompression logic.
- Data Types: Support for
NULLvalues and fixed-point decimals is currently missing (decimals are handled as floats). - Encoding Heuristics: While the paper uses simple heuristics to choose encodings (e.g., "if RLE ratio > 20, use RLE"), a more sophisticated, cost-based optimizer is needed to decide when the overhead of RLE-to-Plain conversion is worth the benefit.
- Write Performance: The focus is entirely on read-heavy analytics; the cost of creating these compressed representations in a high-velocity "ingest" scenario is not explored.
Summary updated