【实验与分析】基于哈希与基于排序的分组聚合:一项聚焦的实证研究【扩展版】
[Experiments \& Analysis] Hash-Based vs. Sort-Based Group-By-Aggregate: A Focused Empirical Study [Extended Version]
AI总结:
本文通过Apache AsterixDB实证对比基于哈希与基于排序的分组聚合(GBA)方法,分析其在不同数据规模、分组数量等场景下的优缺点,为优化GBA查询性能提供实用指导。
摘要:
分组聚合(GBA)查询是数据分析的重要组成部分,允许用户按特定属性对数据分组并应用求和、平均和计数等聚合函数。数据库管理系统(DBMSs)通常使用基于排序或基于哈希的方法执行GBA查询,每种方法都有独特优势和权衡。基于排序的方法对大型数据集高效,但因记录比较计算成本高昂,尤其在分组数量少的情况下。相比之下,基于哈希的方法总体性能更快,但需要大量内存,处理大量分组或数据分布不均时会遭遇哈希冲突。本文提出一项聚焦的实证研究,使用Apache AsterixDB在不同数据大小、数据集和分组计数下比较这两种方法,分析其优缺点。研究发现,基于排序的方法在大型数据集或后续操作受益于排序数据的场景中表现出色,而基于哈希的方法在小型数据集或分组较少的场景中更具优势。结果为每种方法适用的场景提供了见解,为优化GBA查询性能提供实用指导。
英文摘要:
Group-by-aggregate (GBA) queries are integral to data analysis, allowing users to group data by specific attributes and apply aggregate functions such as sum, average, and count. Database Management Systems (DBMSs) typically execute GBA queries using either sort- or hash-based methods, each with unique advantages and trade-offs. Sort-based approaches are efficient for large datasets but become computationally expensive due to record comparisons, especially in cases with a small number of groups. In contrast, hash-based approaches offer faster performance in general but require significant memory and can suffer from hash collisions when handling large numbers of groups or uneven data distributions. This paper presents a focused empirical study comparing these two approaches, analyzing their strengths and weaknesses across varying data sizes, datasets, and group counts using Apache AsterixDB. Our findings indicate that sort-based methods excel in scenarios with large datasets or when subsequent operations benefit from sorted data, whereas hash-based methods are advantageous for smaller datasets or scenarios with fewer groupings. Our results provide insights into the scenarios where each method excels, offering practical guidance for optimizing GBA query performance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。