skip to main content
article
Free Access

Optimization of queries with user-defined predicates

Published:01 June 1999Publication History
Skip Abstract Section

Abstract

Relational databases provide the ability to store user-defined functions and predicates which can be invoked in SQL queries. When evaluation of a user-defined predicate is relatively expensive, the traditional method of evaluating predicates as early as possible is no longer a sound heuristic. There are two previous approaches for optimizing such queries. However, neither is able to guarantee the optimal plan over the desired execution space. We present efficient techniques that are able to guarantee the choice of an optimal plan over the desired execution space. The optimization algorithm with complete rank-ordering improves upon the naive optimization algorithm by exploiting the nature of the cost formulas for join methods and is polynomial in the number of user-defined predicates (for a given number of relations.) We also propose pruning rules that significantly reduce the cost of searching the execution space for both the naive algorithm as well as for the optimization algorithm with complete rank-ordering, without compromising optimality. We also propose a conservative local heuristic that is simpler and has low optimization overhead. Although it is not always guaranteed to find the optimal plans, it produces close to optimal plans in most cases. We discuss how, depending on application requirements, to determine the algorithm of choice. It should be emphasized that our optimization algorithms handle user-defined selections as well as user-defined join predicates uniformly. We present complexity analysis and experimental comparison of the algorithms.

References

  1. CHAUDHURI, S. AND SHIM, K. 1993. Query optimization in the presence of foreign functions. In Proceedings of the 19th International Conference on Very Large Data Bases (VLDB '93, Dublin, Ireland, Aug.). Morgan Kaufmann Publishers Inc., San Francisco, CA, 526-541. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. CHAUDHURI, S. AND SHIM, K. 1994. Including group-by in query optimization. In Proceedings of the 20th International Conference on Very Large Data Bases (VLDB'94, Santiago, Chile, Sept.). VLDB Endowment, Berkeley, CA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. CHAUDHURI, S. AND SHIM, K. 1996. Optimization with user-defined predicates. In Proceedings of the 22nd International Conference on Very Large Data Bases (VLDB '96, Mumbai, India, Sept.). Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. CHIMENTI, D., GAMBOA, R., AND KRISHNAMURTHY, R. 1989. Towards an open architecture for LDL. In Proceedings of the 15th International Conference on Very Large Data Bases (VLDB '89, Amsterdam, The Netherlands, Aug 22-25), R. P. van de Riet, Ed. Morgan Kaufmann Publishers Inc., San Francisco, CA, 195-203. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. CORMEN, T. H., LEISERSON, C. E., AND RIVEST, R. L. 1990. Introduction to Algorithms. MIT Press, Cambridge, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. GANGULY, S., HASAN, W., AND KRISHNAMURTHY, R. 1992. Query optimization for parallel execution. In Proceedings of the 1992 ACM SIGMOD International Conference on Management of Data (SIGMOD '92, San Diego, CA, June 2-5), M. Stonebraker, Ed. ACM Press, New York, NY, 9-18. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. GRAEFE, G. AND DEWITT, D.J. 1987. The exodus optimizer generator. In Proceedings of the ACM SIGMOD Annual Conference on Management of Data (SIGMOD '87, San Francisco, CA, May 27-29), U. Dayal, Ed. ACM Press, New York, NY, 160-172. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. GRAEFE, G. AND MCKENNA, W.J. 1993. The volcano optimizer generator: Extensibility and efficient search. In Proceedings of the 9th International Conference on Data Engineering (Vienna, Austria, Apr.). IEEE Computer Society, Washington, DC, 209-218. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. HELLERSTEIN, J. M. 1994. Practical predicate placement. In Proceedings of the 1994 ACM SIGMOD International Conference on Management of Data (SIGMOD '94, Minneapolis, MN, May 24-27), R. T. Snodgrass and M. Winslett, Eds. ACM Press, New York, NY, 325-335. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. HELLERSTEIN, g. M. 1995. Optimization and execution techniques for queries with expensive methods. Ph.D. Dissertation. University of Wisconsin at Madison, Madison, WI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. HELLERSTEIN, J. M. AND STONEBRAKER, M. 1993. Predicate migration: Optimizing queries with expensive predicates. In Proceedings of the 1993 ACM SIGMOD International Conference on Management of Data (SIGMOD '93, Washington, DC, May 26-28), P. Buneman and S. Jajodia, Eds. ACM Press, New York, NY, 267-276. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. IOANNIDIS, Y. E. AND KANG, Y. C. 1990. Randomized algorithms for optimizing large join queries. In Proceedings of the 1990 ACM SIGMOD International Conference on Management of Data (SIGMOD '90, Atlantic City, NJ, May 23-25, 1990), H. Garcia-Molina, Ed. ACM Press, New York, NY, 312-321. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. KEMPER, A., MOERKETTE, G., AND STEINBRUNN, M. 1992. Optimizing boolean expressions in object-bases. In Proceedings of the 18th International Conference on Very Large Data Bases (Vancouver, B.C., Aug.). VLDB Endowment, Berkeley, CA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. KRISHNAMURTHY, R., BORAL, H., AND ZANIOLO, C. 1986. Optimization of nonrecursive queries. In Proceedings of the 12th International Conference on Very Large Data Bases (Kyoto, Japan, Aug.). VLDB Endowment, Berkeley, CA, 128-137. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. LEE, M. K., FREYTAG, J. C., AND LOHMAN, G. M. 1988. Implementing an interpreter for functional rules in a query optimizer. In Proceedings of the 14th International Conference on Very Large Data Bases (Los Angeles, CA). Morgan Kaufmann Publishers Inc., San Francisco, CA, 218-229. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. MONMA, C. L. AND SIDNEY, J. 1979. Sequencing with series-parallel precedence constraints. Math. Oper. Res. 4, 215-224.Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. SELINGER, P. G., ASTRAHAN, M. M., LORIE, R. A., AND PRICE, T. G. 1979. Access path selection in a relational database management system. In Proceedings of ACM SIGMOD International Conference on Management of Data (SIGMOD '79, Boston, MA, May 30-June 1). ACM Press, New York, NY, 23-34. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. SHAPIRO, L. D. 1986. Join processing in database systems with large main memories. ACM Trans. Database Syst. 11, 3 (Sept. 1986), 239-264. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. SHIM, K. 1993. Advanced query optimization techniques for relational database systems. Ph.D. Dissertation. University of Maryland at College Park, College Park, MD. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. WHANG, K.-Y. AND KRISHNAMURTHY, R. 1990. Query optimization in a memory-resident domain relational calculus database system. ACM Trans. Database Syst. 15, 1 (Mar. 1990), 67-95. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Optimization of queries with user-defined predicates

      Recommendations

      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

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader