Optimization of queries with user-defined predicates
- 1 June 1999
- journal article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Database Systems
- Vol. 24 (2) , 177-228
- https://doi.org/10.1145/320248.320249
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.Keywords
This publication has 9 references indexed in Scilit:
- Practical predicate placementPublished by Association for Computing Machinery (ACM) ,1994
- Predicate migrationPublished by Association for Computing Machinery (ACM) ,1993
- Query optimization for parallel executionPublished by Association for Computing Machinery (ACM) ,1992
- Randomized algorithms for optimizing large join queriesPublished by Association for Computing Machinery (ACM) ,1990
- Query optimization in a memory-resident domain relational calculus database systemACM Transactions on Database Systems, 1990
- The EXODUS optimizer generatorPublished by Association for Computing Machinery (ACM) ,1987
- Join processing in database systems with large main memoriesACM Transactions on Database Systems, 1986
- Sequencing with Series-Parallel Precedence ConstraintsMathematics of Operations Research, 1979
- Access path selection in a relational database management systemPublished by Association for Computing Machinery (ACM) ,1979