Structural decomposition methods offer powerful theoretical guarantees for join evaluation, yet they are rarely used in real-world query optimizers. A major reason is the difficulty of combining cost-based plan search and structure-based evaluation. In this work, we bridge this gap by introducing meta-decompositions for acyclic queries, a novel representation that succinctly represents all possible join trees and enables their efficient enumeration. Meta-decompositions can be constructed in polynomial time and have sizes linear in the query size. We design an efficient polynomial-time cost-based optimizer based directly on the meta-decomposition, without the need to explicitly enumerate all possible join trees. We characterize plans found by this approach using a novel notion of width, which effectively implies the theoretical worst-case asymptotic bounds of intermediate result sizes and running time of any query plan. Experimental results demonstrate that, in practice, the plans in our class are consistently comparable to -- even in many cases better than -- the optimal ones found by the state-of-the-art dynamic programming approach, especially on large and complex queries, while our planning process runs by orders of magnitude faster, comparable to the time taken by common heuristic methods.
翻译:结构分解方法为连接评估提供了强有力的理论保证,但在实际查询优化器中却很少使用。一个主要原因是难以将基于成本的计划搜索与基于结构的评估相结合。在本工作中,我们通过为无环查询引入元分解来弥合这一差距,这是一种新颖的表示方法,能够简洁地表示所有可能的连接树并支持其高效枚举。元分解可在多项式时间内构建,且其规模与查询大小呈线性关系。我们基于元分解直接设计了一个高效的多项式时间成本优化器,无需显式枚举所有可能的连接树。我们使用一种新颖的宽度概念来刻画通过此方法找到的计划,该概念有效地蕴含了任何查询计划的中间结果大小和运行时间的理论最坏情况渐近上界。实验结果表明,在实践中,我们方法所生成的计划始终与最先进的动态规划方法找到的最优计划相当——甚至在许多情况下更优——尤其是在大型复杂查询上,同时我们的规划过程运行速度快数个数量级,与常见启发式方法所需的时间相当。