skip to main content
article
Free Access

On the translation of relational queries into iterative programs

Published:01 March 1989Publication History
Skip Abstract Section

Abstract

This paper investigates the problem of translating set-oriented query specifications into iterative programs. The translation uses techniques of functional programming and program transformation.

We present two algorithms that generate iterative programs from algebra-based query specifications. The first algorithm translates query specifications into recursive programs. Those are simplified by sets of transformation rules before the algorithm generates the final iterative form. The second algorithm uses a two-level translation that generates iterative programs faster than the first algorithm. On the first level a small set of transformation rules performs structural simplification before the functional combination on the second level yields the final iterative form.

References

  1. 1 ASTRAHAN ET AL. SYSTEM R: Relational approach to database management. ACM Trans. Database Syst. 1, 2 (June 1976), 97-137 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2 BACKUS, J. Can programming be liberated from the von Neumann style? A functional style and its algebra of programs. In Commun. ACM 21, 8 (Aug. 1978), 613-641. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 BELLEGARDE, F. Rewriting systems on FP expressions that reduce the number of sequences they yield. In ACM Symposium on LISP and Functional Programming (Austin, Tex., Aug. 1984). ACM, New York, 1984, 63-73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4 BIRD, R. S. The promotion and accumulation strategies in transformational programming. ACM Trans. Program. Lang. Syst. 6, 4 (Oct. 1984), 487-504. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 BUNEMAN, P., AND FRANKEL, R.E. An implementation technique for database query languages. ACM Trans. Database Syst. 7, 2 (June 1982), 164-186. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6 BURSTALL, R. M., AND DARLINGTON, J. A transformation system for developing recursive programs. J. ACM 24, 1 (Jan. 1977), 44-67. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7 CODD, E.F. A relational model of data for large shared data banks. Commun. ACM 13, 6 (June 1970), 377-387. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 COHEN, N.H. Source-to-source improvement of recursive programs. Ph.D. dissertation, Harvard University, May 1980.Google ScholarGoogle Scholar
  9. 9 COLUSSI, L. Recursion as an effective step in program development. ACM Trans. Program. Lang. Syst. 6, 1 (Jan. 1984), 55-67. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10 DAN{ELS, D. Query compilation in a distributed database system. Tech. Rep. RJ 3432, IBM Research Laboratory, San Jose, CA, Mar. 1982.Google ScholarGoogle Scholar
  11. 11 DARLINGTON, J., AND BURSTALL, R.M. A system which automatically improves programs, in Acta Inf. 6, 1 (1976), 41-60.Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 12 FREYTAG, J. C. Translating relational queries into iterative programs. Ph.D. dissertation, Harvard University, Sept. 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13 FREYTAO, J. C., AND GOODMAN, N. Rule-based translation of relational queries into iterative programs. In ACM-SIGMOD Conference on Management of Data (Washington, D.C.), ACM, New York, 206-214. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 14 FRIEDMAN, D. P., AND WISE, D. S. CONS should not evaluate its arguments. In Automata, Languages, and Programming, S. Michaelson and R. Milner, eds., Edinburgh University Press, Edinburgh, 1976, 257-284.Google ScholarGoogle Scholar
  15. 15 GIVLER, J. S., AND KIEBURTZ, R.B. Schema recognition for program transformation, in ACM Symposium on LISP and Functional Programming (Austin, Tex., Aug. 1984). ACM, New York, 1984, 74-84. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16 HENDERSON, P., AND MORRIS, J. H. A Lazy Evaluator. In Third ACM SIGACT-SIGPLAN Symposium of Principles of Programming Languages (Atlanta, Ga., 1976). ACM, New York, 1976, 96-103. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 17 HUET, G. Confluent reductions: Abstract properties and applications of term rewriting systems. J. ACM 27, 4 (Oct. 1980), 797-821. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 18 LORIE, R. A., AND WADE, B.W. The compilation of a high level data language. Tech. Rep., IBM Research Laboratory, San Jose, CA, 1979.Google ScholarGoogle Scholar
  19. 19 MEYER, A. What is a model of lambda calculus? Inf. Contr. 52, (1982), 87-122.Google ScholarGoogle ScholarCross RefCross Ref
  20. 20 ROSENTHAL, A., AND REINER, D. An architecture for query optimization. In A CM-SIGMOD Conference on Management of Data (Orlando, Fla., 1982). ACM, New York, 1982, 246-255. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 21 SHASHA, D. Concurrent algorithms for search structures. Ph.D. dissertation, Harvard University, May 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22 STONEBRAKER, M., WONG, E., ET AL. The design and implementation of INGRES. ACM Trans. Database Syst. i, 3 (Sept. 1976), 189-222. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23 STO~, J.E. Denotational Semantics. MIT Press, Cambridge, Ma., 1977.Google ScholarGoogle Scholar
  24. 24 TENNENT, R. The denotational semantics of programming languages. Commun. ACM 19, 8 {Aug. 1976), 437-453. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 25 ULLMAN, J.D. Principles of Database Systems. Computer Science Press, San Francisco, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 26 WILLIAMS, J.H. Notes on the FP Style of Functional Programming. In Functional Programming and its Applications. J. Darlington, P. Henderson, and D. A. Turner, eds. Cambridge University Press, 1982, 193-215.Google ScholarGoogle Scholar

Index Terms

  1. On the translation of relational queries into iterative programs

            Recommendations

            Reviews

            Bernhard Thalheim

            This paper presents a solution to the translation problem for relational queries based on functional programming and program transformation. Functional programming with operators defined C-like is used for the formulation of simple algebraic rules. The paper describes two algorithms that translate the query evaluation plan into programs directly executable on the physical database processor. The first translation algorithm relies on the properties of recursive programs. The second algorithm manipulates information about the control structure and functional behavior of programs independently. The algorithms are both computationally and syntactically equivalent but differ in the results of and the approaches to different transformation steps. The presented algorithms have several advantages. They minimize the amount of overhead during execution, guarantee a certain degree of machine independence, and simplify the translation problem by separating the compilation into independent steps.

            Access critical reviews of Computing literature here

            Become a reviewer for Computing Reviews.

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            Full Access

            • Published in

              cover image ACM Transactions on Database Systems
              ACM Transactions on Database Systems  Volume 14, Issue 1
              March 1989
              146 pages
              ISSN:0362-5915
              EISSN:1557-4644
              DOI:10.1145/62032
              Issue’s Table of Contents

              Copyright © 1989 ACM

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 1 March 1989
              Published in tods Volume 14, Issue 1

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • article

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader