Padraig O'Sullivan wrote:
Hi!

I have a quick question on some code I am thinking of removing that
I'd like to get some opinions on. At the moment, there are 2 functions
in the optimizer in Drizzle for searching for an optimal query plan:

 - find_best
 - greedy_search

The method that is used is determined by the optimizer_search_depth
parameter. We can see this from the following code:

You can do better than either by intelligent traversal of the choice tree:

  1. Consider the most optimistic alternatives (unique key / single
     record) first.
  2. At each stage, estimate the minimal cost of the remaining sub-tree
  3. The if the cost to any stage plus the minimal cost of the
     remaining sub-tree is greater than the best plan, don't bother to
     continue evaluation of the sub-tree.

Interbase had a customer with a 17 way join. The good news was that evaluation of the optimal plan was only 40 seconds (computers were slower then). The bad news was that optimization took 13 hours. Search pruning was clearly in order.

Performinng tree evaluation in optimistic -- heuristic -- order violates the spirit but not the letter of cost based optimization. And it saves a hell of a lot of time without giving up any possibility of finding the optimal solution.

--
Jim Starkey
Sent from Shearwater, off the coast of New England


_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to