Skip to main content
QUICK REVIEW

[论文解读] Algorithms for Rewriting Aggregate Queries Using Views

Sara Cohen, Werner Nutt|Lirias (KU Leuven)|Nov 17, 2000
Advanced Database Systems and Queries被引用 4
一句话总结

本文提出了用于使用物化视图重写聚合查询的可靠且完备的算法,重点关注 COUNT 和 SUM 操作符。通过引入查询等价性的句法表征,将非聚合查询重写技术(如 buckets 算法)扩展至聚合场景,确保在实际数据库优化场景中的正确性与完备性。

ABSTRACT

Queries involving aggregation are typical in database applications. One of the main ideas to optimize the execution of an aggregate query is to reuse results of previously answered queries. This leads to the problem of rewriting aggregate queries using views. Due to a lack of theory, algorithms for this problem were rather ad-hoc. They were sound, but were not proven to be complete. Recently we have given syntactic characterizations for the equivalence of aggregate queries and applied them to decide when there exist rewritings. However, these decision procedures do not lend themselves immediately to an implementation. In this paper, we present practical algorithms for rewriting queries with $\COUNT$ and $\SUM$. Our algorithms are sound. They are also complete for important cases. Our techniques can be used to improve well-known procedures for rewriting non-aggregate queries. These procedures can then be adapted to obtain algorithms for rewriting queries with $\MIN$ and $\MAX$. The algorithms presented are a basis for realizing optimizers that rewrite queries using views.

研究动机与目标

  • 解决使用物化视图重写聚合查询时理论基础不足的问题。
  • 为常见的聚合操作符(如 COUNT 和 SUM)开发既可靠又完备的实用算法。
  • 将现有非聚合查询重写技术扩展至支持聚合操作,从而提升效率与正确性。
  • 通过重用预计算结果,实现数据仓库和大规模数据库应用中的高效查询优化。

提出的方法

  • 利用来自 NSS98 和 CNS99 的聚合查询等价性句法表征,指导重写过程的构建。
  • 对非聚合视图应用修改后的 buckets 算法,过滤掉无法贡献于有效重写的视图。
  • 引入基于同态的展开技术,验证候选重写与原始查询之间的等价性。
  • 基于变量覆盖范围和一致性限制视图在 buckets 中的包含,通过缩小搜索空间提升性能。
  • 通过将等价性检查简化为关系查询的核心等价性,将方法适配以处理 MAX 和 MIN 查询。
  • 在 SICStus Prolog 中实现算法,证明了其在实际场景中的可行性与实用性。

实验结果

研究问题

  • RQ1我们能否设计出既可靠又完备的算法,用于使用视图重写聚合查询?
  • RQ2如何利用聚合查询等价性的句法表征来指导有效重写的构建?
  • RQ3能否增强现有的非聚合查询重写算法以支持聚合操作,同时保持完备性?
  • RQ4在重写过程中通过过滤无关视图,能实现多大的性能提升?
  • RQ5如何将针对 COUNT 和 SUM 的技术扩展至支持 MIN 和 MAX 查询?

主要发现

  • 所提出的算法在重要实际场景(包括线性查询和关系查询)中均具备可靠性和完备性。
  • 基于变量覆盖范围和一致性的视图过滤显著减少了候选重写的数量,从而提升了算法性能。
  • 该方法支持重用预计算视图,减少了对大型数据库进行全表扫描的需求。
  • 通过将等价性检查简化为关系查询的核心等价性,该方法能良好地推广至 MAX 和 MIN 查询。
  • 算法已在 SICStus Prolog 中实现,证明了其在真实世界查询优化中的可行性与实用性。
  • 将句法等价性检查集成到重写过程中,确保了正确性,且无需依赖启发式方法。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。