Typical queries over data warehouses perform aggregation. 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. More precisely, given a set of queries, called "views," and a new query, the task is to reformulate the new query with the help of the views in such a way that executing the reformulated query over the views yields the same result as executing the original query over the base relations. Due to a lack of theory, so far algorithms for this problem were rather ad-hoc. They were sound, but were not proven to be complete.In earlier work we have given syntactic characterizations for the equivalence of aggregate queries, and applied them decide when there exist rewritings. However, these decision procedures are highly nondeterministic and do not lend themselves immediately to an implementation.In the current paper, we refine those procedures by eliminating the nondeterminism as much as possible, thus obtaining practical algorithms for rewriting queries with the operators count and sum. It can be proved that our algorithms are complete for queries where each relation occurs only once and for queries without comparisons. We also show how algorithms for rewriting nonaggregateThe copyright of this paper belongs to the paper's authors. Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage. Heidelberg, Germany, 14. -15.6. 1999 (S. Gatziu, M. Jeusfeld, M. Staudt, Y. Vassiliou, eds.) http://sunsite.informatik.rwth-aachen.de/Publications/CEUR-WS/Vol-19/ queries can be modified to obtain rewriting algorithms for queries with min and max.
Proceedings of the International Workshop on Design and Management of Data Warehouses (DMDW'99)These algorithms are a basis for realizing optimizers that rewrite aggregate queries using views.