1. A method of optimizing a query, comprising: determining a cost estimate for a query; determining a budget for optimizing the query based on the cost estimate; determining a normalized complexity of the query; determining a strategy based on the normalized complexity and the budget, wherein the strategy specifies a limit to a search space enumerated during optimization of the query; and optimizing the query based on the strategy.
1. A method of optimizing a query, comprising: determining a cost estimate for a query; determining a budget for optimizing the query based on the cost estimate; determining a normalized complexity of the query; determining a strategy based on the normalized complexity and the budget, wherein the strategy specifies a limit to a search space enumerated during optimization of the query; and optimizing the query based on the strategy. 3. The method recited in claim 1 , further comprising: generating a heuristic query plan for the query; enumerating a heuristic query plan from a multijoin to generate a first plurality of substitutes for the multijoin; assigning a potential to each of the first plurality of substitutes, wherein the potential comprises a potential to produce a low cost query plan; and generating a query plan based on the assigned potential and the first plurality of substitutes.