1. In a database system, a method for optimization of a query, the method comprising: receiving a query requesting data from a database; enumerating a plurality of plans which can be used for obtaining data requested by the query; creating a search tree based on said plurality of plans, the search tree having nodes representing segments of said plurality of plans; selecting a limited number of nodes of the search tree for evaluation to limit effort spent on query optimization; and generating a complete plan for execution of the query by performing the substeps of: evaluating the selected nodes of the search tree; and if the evaluation determines that a given node is more favorable than comparable nodes previously evaluated, retaining the given node as part of the complete plan.