Algorithms for Rewriting Aggregate Queries Using Views
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.
Unable to display preview. Download preview PDF.
- CNS99.S. Cohen, W. Nutt, and A. Serebrenik. Rewriting aggregate queries using views. In Ch. Papadimitriou, editor, Proc. 18(suth) Symposium on Principles of Database Systems, Philadelphia (Pennsylvania, USA), May 1999. ACM Press.Google Scholar
- CNS00.S. Cohen, W. Nutt, and A. Serebrenik. Algorithms for rewriting aggregate queries using views. Technical Report CW292, Departement Computerwetenschappen, K.U.Leuven, Leuven, Belgium, 2000. Available at http://www.cs.kuleuven.ac.be/publicaties/rapporten/CW2000.html.Google Scholar
- CV93.S. Chaudhuri and M. Vardi. Optimization of real conjunctive queries. In Proc. 12(suth) Symposium on Principles of Database Systems, Washington (D.C., USA), May 1993. ACM Press.Google Scholar
- GHQ95.A. Gupta, V. Harinarayan, and D. Quass. Aggregate query processing in data warehouses. In Proc. 21(sust) International Conference on Very Large Data Bases. Morgan Kaufmann Publishers, August 1995.Google Scholar
- HRU96.V. Harinarayan, A. Rajaraman, and J. Ullman. Implementing data cubes efficiently. In Proc. 1996 ACM SIGMOD International Conference on Management of Data, pages 205–227, Montreal (Canada), June 1996.Google Scholar
- LMSS95.A.Y. Levy, A.O. Mendelzon, Y. Sagiv, and D. Srivastava. Answering queries using views. In Proc. 14(suth) Symposium on Principles of Database Systems, pages 95–104, San Jose (California, USA), May 1995. ACM Press.Google Scholar
- LRO96.A.Y. Levy, A. Rajaraman, and J. Ordille. Querying heterogeneous information sources using source description. In Proc. 22nd International Conference on Very Large Data Bases, Bombay (India), September 1996. Morgan Kaufmann Publishers.Google Scholar
- NSS98.W. Nutt, Y. Sagiv, and S. Shurin. Deciding equivalences among aggregate queries. In J. Paredaens, editor, Proc. 17(suth) Symposium on Principles of Database Systems, pages 214–223, Seattle (Washington, USA), June 1998. ACM Press. Long version as Report of Esprit LTR DWQ.Google Scholar
- SDJL96.D. Srivastava, Sh. Dar, H.V. Jagadish, and A.Y. Levy. Answering queries with aggregation using views. In Proc. 22(sund) International Conference on Very Large Data Bases, Bombay (India), September 1996. Morgan Kaufmann Publishers.Google Scholar
- Ull89.J. Ullman. Principles of Database and Knowledge-Base Systems, Vol. II: The New Technologies. Computer Science Press, New York (New York, USA), 1989.Google Scholar