29. In a database system, a method for optimization of a query, the method executed by a processor comprising: generating a search space comprising only left deep nested loop join subtree candidate subplans for executing the query; building a plan for executing the query in the search space based on selecting candidate subplans having favorable execution costs; after a plan has been built, determining whether any left deep nested loop join subtree of the plan should be transformed to a semantically correct bushy tree shape; creating a transformed plan by transforming any left deep nested loop join subtrees determined to need transformation to a semantically correct bushy tree shape; and constructing a query execution plan for executing the query based on the transformed plan.
29. In a database system, a method for optimization of a query, the method executed by a processor comprising: generating a search space comprising only left deep nested loop join subtree candidate subplans for executing the query; building a plan for executing the query in the search space based on selecting candidate subplans having favorable execution costs; after a plan has been built, determining whether any left deep nested loop join subtree of the plan should be transformed to a semantically correct bushy tree shape; creating a transformed plan by transforming any left deep nested loop join subtrees determined to need transformation to a semantically correct bushy tree shape; and constructing a query execution plan for executing the query based on the transformed plan. 30. The method of claim 29 , wherein said generating step includes grouping said candidate subplans into classes based on tables covered by each candidate subplan and selecting a particular subplan in each class having lowest execution costs.