We study the problem of statically optimizing select-project-join (SPJ) plans where unary key constraints are allowed. A natural measure of a plan, which we call the output degree and which has been studied previously, is the minimum degree of a polynomial bounding the plan's output relation, as a function of the input database's maximum relation size. This measure is, by definition, invariant under passing from a plan to another plan that is semantically equivalent to the first. In this article, we consider a plan measure which we call the intermediate degree; this measure is defined to be the minimum degree bounding the size of all intermediate relations computed during a plan's execution -- again, as a function of the input database's maximum relation size. We present an algorithm that, given an SPJ plan $q$ and a set $\Sigma$ of unary keys, computes an SPJ plan $q'$ that is semantically equivalent to $q$ (over databases satisfying $\Sigma$) and that has the minimum intermediate degree over all such semantically equivalent plans. For the types of plans considered, we thus obtain a complete and effective understanding of intermediate degree.
翻译:我们研究了在允许一元键约束条件下静态优化选择-投影-连接(SPJ)计划的问题。一个自然的计划度量指标(我们称之为输出度,此前已有研究)是指:作为输入数据库最大关系规模的函数,能够界定计划输出关系规模的多项式的最小次数。根据定义,该度量在从某个计划转换到与之语义等价的其他计划时保持不变。本文中,我们考虑一种称为中间度的计划度量指标;该指标定义为:作为输入数据库最大关系规模的函数,能够界定计划执行过程中所有中间关系规模的多项式的最小次数。我们提出一种算法,在给定SPJ计划$q$和一元键集合$\Sigma$的条件下,可计算出与$q$语义等价(在满足$\Sigma$的数据库上)的SPJ计划$q'$,且该计划在所有此类语义等价计划中具有最小的中间度。对于所考虑的计划类型,我们由此获得了对中间度完整且有效的理解。