基于梯度的连接顺序
Gradient-Based Join Ordering
AI总结:
本文提出基于梯度的连接顺序方法,通过连续松弛和可微约束,在放松空间中寻找低成本计划,优于传统离散搜索方法。
摘要:
连接顺序是NP难问题,涉及选择数据库查询中最有效的连接顺序。传统方法将问题视为二叉树的离散组合搜索,但存在效果与效率的权衡。本文展示当成本模型可微时,查询计划可连续松弛为软邻接矩阵,结合可微约束确保计划有效性,从而在放松空间中通过梯度搜索低成本计划。使用图神经网络作为成本模型,证明该方法在两个不同图数据集上能获得与传统离散搜索相当甚至更低的成本,并且运行时间优于离散搜索算法。
英文摘要:
Join ordering is the NP-hard problem of selecting the most efficient order in which to evaluate joins (conjunctive, binary operators) in a database query. Because query execution performance critically depends on this choice, join ordering lies at the core of query optimization. Traditional approaches cast this problem as a discrete combinatorial search over binary trees guided by a cost model, but they have trade-offs between effectiveness and efficiency. We show that when the cost model is differentiable, query plans can be continuously relaxed into a soft adjacency matrix that represents a superposition of plans. This continuous relaxation, combined with differentiable constraints that enforce plan validity, enables a gradient-based search for low-cost plans within this relaxed space. Using a Graph Neural Network as the cost model, we demonstrate that this gradient-based approach can find comparable and even lower-cost plans compared to traditional discrete search methods on two different graph datasets. Furthermore, we empirically show that the runtime of this approach scales better than discrete search algorithms. We believe this first step towards gradient-based join ordering can lead to more effective and efficient query optimizers in the future.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。