Abstract
This paper investigates the optimisation of aggregation functions in the context of computationally complete database programming languages and aims to generalise and provide a unifying formal foundation for previous work. We define a ‘fold’ operator φ over collection types in terms of which operations such as selection, projection, join and group-by can be defined, as well as aggregation functions such as sum, max and min. We introduce two equivalences for φ which respectively govern the commuting and coalescing of applications of φ. From these two equivalences we then formally derive equivalences governing the commuting and coalescing of iteration operations over collections, the mapping of aggregation functions over grouped collections, the introduction and elimination of aggregation functions, and the promotion of aggregation functions through iteration operations. We also show how some of these equivalences can be used to optimise comprehensions, a high-level query construct supported by many database languages.
Chapter PDF
References
F.Bancilhon, T.Briggs, S.Khoshafian and P.Valduriez, FAD, a powerful and simple database language, Proc. 13th VLDB Conference, Brighton, September 1987, pp 97–106.
C.Beeri and Y.Kornatzky, Algebraic optimization of object-oriented query languages, Proc. 3rd ICDT, Paris, December 1990, pp 72–88. Springer-Verlag LNCS 470.
R.Bird and P.Wadler, Introduction to functional programming, Prentice-Hall, 1988.
P.Buneman, L.Libkin, D.Suciu, V.Tannen and L.Wong, Comprehension Syntax, ACM SIGMOD Record, 23(1), pp 87–96, 1994.
P.Buneman, S.Nagvi, V.Tannen and L.Wong, Principles of programming with complex objects and collection types, Theoretical Computer Science, 149(1), pp 3–48, 1995.
S.Chaudhuri and K.Shim, Including group-by in query optimisation, Proc. 20th VLDB Conference, Santiago, September 1994, pp 354–366.
L.Fegaras and D.Maier, Towards an effective calculus for Object Query Languages, Proc. ACM SIGMOD Conference, May 1995, pp 47–58.
T.Grust, J.Kroger, D.Gluche, A.Heuer and M.Scholl, Query evaluation in CROQUE — Calculus and Algebra coincide, Proc. 15th British National Conference on Databases, London, July 1997, pp 84–100. Springer-Verlag LNCS 1271.
A.Gupta, V.Harinarayan and D.Quass, Aggregate query-processing in Data Warehousing Environments, Proc. 21st VLDB Conference, Zurich, 1995, pp 358–369.
N.W.Paton and P.M.D.Gray, Optimising and executing DAPLEX queries using Prolog, The Computer Journal, 33(6), pp 547–555, 1990.
A.Poulovassilis and C.Small, Investigation of algebraic query optimisation for database programming languages, Proc. 20th VLDB Conference, Santiago, 1994, pp 415–426.
A.Poulovassilis and C.Small, Algebraic query optimisation for database programming languages, The VLDB Journal, 5(2), pp 119–132, 1996.
D.A.Schmidt, Denotational Semantics, Allyn and Bacon, 1986.
T.Sheard and L.Fegaras, A fold for all seasons. Proc. ACM Conference on Functional Programming and Computer Architectures (FPCA), 1993, pp 233–242.
H.J.Steenhagen, P.M.G.Apers, H.M.Blanken and R.A.de By, From nested-loop to join queries in OODB, Proc. 20th VLDB Conference, Santiago, 1994, pp 618–629.
P.Trinder, A functional database, D.Phil Thesis, Oxford University, 1989.
P.Trinder, Comprehensions: a query notation for DBPLs. Proc. 3rd Int. Workshop on Database Programming Languages, Nafplion, August 1991, pp 55–68.
P.Wadler, Comprehending Monads, Proc. ACM Conference on Lisp and Functional Programming, Nice, June 1990, pp 61–78.
W.Yan and P.Larson, Eager aggregation and lazy aggregation, Proc. 21st VLDB Conference, Zurich, 1995, pp 345–357.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Poulovassilis, A., Small, C. (1998). Formal foundations for optimising aggregation functions in database programming languages. In: Cluet, S., Hull, R. (eds) Database Programming Languages. DBPL 1997. Lecture Notes in Computer Science, vol 1369. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-64823-2_17
Download citation
DOI: https://doi.org/10.1007/3-540-64823-2_17
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64823-9
Online ISBN: 978-3-540-68534-0
eBook Packages: Springer Book Archive