Efficiently Processing Joins and Grouped Aggregations on GPUs
Bowen Wu, Dimitrios Koutsoukos, Gustavo Alonso
TL;DR
This work investigates GPU-based processing of joins and grouped aggregations, revealing that random global memory accesses during materialization are the primary bottleneck across state-of-the-art operators. It introduces GFTR, a technique that transforms payload data together with keys to enable clustered, sequential access and dramatically reduces materialization costs, achieving up to $2.3 imes$ speedups in joins and $2.2 imes$ in group-by. It also proposes a radix-sort-based partitioning scheme to replace bucket-chaining in partitioned approaches, and offers optimized hash-based group-by, partition-based group-by, and dictionary-encoding strategies, yielding substantial improvements (e.g., up to $19.4 imes$, $2.88 imes$, and $2.63 imes$ respectively in specific workloads). The authors provide cost models and a decision framework to guide query optimizers in selecting the best implementation for a given workload, and validate their findings through extensive experiments across diverse data characteristics, workloads, and data types. The results have practical impact for GPU-accelerated databases, informing operator choices and enabling more predictable, workload-aware query optimization on GPU platforms.
Abstract
There is a growing interest in leveraging GPUs for tasks beyond ML, especially in database systems. Despite the existing extensive work on GPU-based database operators, several questions are still open. For instance, the performance of almost all operators suffers from random accesses, which can account for up to 75% of the runtime. In addition, the group-by operator which is widely used in combination with joins, has not been fully explored for GPU acceleration. Furthermore, existing work often uses limited and unrepresentative workloads for evaluation and does not explore the query optimization aspect, i.e., how to choose the most efficient implementation based on the workload. In this paper, we revisit the state-of-the-art GPU-based join and group-by implementations. We identify their inefficiencies and propose several optimizations. We introduce GFTR, a novel technique to reduce random accesses, leading to speedups of up to 2.3x. We further optimize existing hash-based and sort-based group-by implementations, achieving significant speedups (19.4x and 1.7x, respectively). We also present a new partition-based group-by algorithm ideal for high group cardinalities. We analyze the optimizations with cost models, allowing us to predict the speedup. Finally, we conduct a performance evaluation to analyze each implementation. We conclude by providing practical heuristics to guide query optimizers in selecting the most efficient implementation for a given workload.
