Cardinality estimation has long been crucial for cost-based database optimizers in identifying optimal query execution plans, attracting significant attention over the past decades. While recent advancements have significantly improved the accuracy of multi-table join query estimations, these methods introduce challenges such as higher space overhead, increased latency, and greater complexity, especially when integrated with the binary join framework. In this paper, we introduce a novel cardinality estimation method named TKHist, which addresses these challenges by relaxing the uniformity assumption in histograms. TKHist captures bin-wise non-uniformity information, enabling accurate cardinality estimation for join queries without filter predicates. Furthermore, we explore the attribute independent assumption, which can lead to significant over-estimation rather than under-estimation in multi-table join queries. To address this issue, we propose the dominating join path correlation discovery algorithm to highlight and manage correlations between join keys and filter predicates. Our extensive experiments on popular benchmarks demonstrate that TKHist reduces error variance by 2-3 orders of magnitude compared to SOTA methods, while maintaining comparable or lower memory usage.
翻译:基数估计长期以来对于基于成本的数据库优化器识别最优查询执行计划至关重要,在过去数十年间吸引了广泛关注。尽管近期进展显著提升了多表连接查询估计的精度,但这些方法也带来了更高空间开销、更大延迟和更强复杂性等挑战,尤其在与二元连接框架集成时。本文提出一种名为TKHist的新型基数估计方法,通过放宽直方图中的均匀性假设来解决这些挑战。TKHist捕获了分箱级别的非均匀性信息,使得无需过滤谓词即可实现连接查询的精确基数估计。此外,我们探讨了属性独立性假设——该假设可能导致多表连接查询中出现显著高估而非低估的问题。为解决此问题,我们提出主导连接路径相关性发现算法,以突显并管理连接键与过滤谓词之间的相关性。在主流基准测试上的大量实验表明,相较于SOTA方法,TKHist将误差方差降低了2-3个数量级,同时保持相当或更低的内存使用量。