17. A non-transitory, computer-readable medium comprising machine-readable instructions executable by a processor to optimize a query, wherein the machine-readable instructions, when executed by the processor, cause the processor to: determine a cost estimate for a query; determine a budget for optimizing the query based on the cost estimate; determine a normalized complexity of the query; determine a strategy based on the normalized complexity and the budget, wherein the strategy comprises a potential threshold; generate a plurality of possible query plans for the query; assign a potential to each of the plurality of possible query plans, wherein the potential represents a ranking based on a likelihood of producing a low cost query plan; determine whether the plurality of possible query plans exceeds the potential threshold; enumerate the plurality of possible query plans based on the determination; and generate a query plan based on the enumeration.
17. A non-transitory, computer-readable medium comprising machine-readable instructions executable by a processor to optimize a query, wherein the machine-readable instructions, when executed by the processor, cause the processor to: determine a cost estimate for a query; determine a budget for optimizing the query based on the cost estimate; determine a normalized complexity of the query; determine a strategy based on the normalized complexity and the budget, wherein the strategy comprises a potential threshold; generate a plurality of possible query plans for the query; assign a potential to each of the plurality of possible query plans, wherein the potential represents a ranking based on a likelihood of producing a low cost query plan; determine whether the plurality of possible query plans exceeds the potential threshold; enumerate the plurality of possible query plans based on the determination; and generate a query plan based on the enumeration. 20. The non-transitory, computer-readable medium recited in claim 17 , wherein the machine-readable instructions that cause the processor to generate a plurality of possible query plans comprises machine-readable instructions that cause the processor to: generate a heuristic query plan for the query; enumerate a multijoin of the heuristic query plan to generate a first plurality of substitutes for the multijoin; assign a potential to each of the first plurality of substitutes, wherein the potential represents a ranking based on a likelihood of producing a low cost query plan; and generate the query plan based on the assigned potential and the first plurality of substitutes.