-
Notifications
You must be signed in to change notification settings - Fork 3
Query Planning & Optimization II.a: VolcanoPlanner Basics
The VolcanoPlanner repeatedly fires rules in a series of phases to reduce the cost. The exact rules that may be fired varies across phases. In each phase, the planner sets the initial importance of the existing RelSubSets (TODO: What is RelSubset? What is the initial importance?). The planner then iterates over the rule matches in descending order of importance (until the rule queue becomes empty). Furthermore, after every 10 iterations without an implementable plan, RelSubSets that contain only logical RelNodes are given an importance boost. Once an implementable plan is found, the artificially raised importance values are cleared.
The planner offers two ways to select the implementation within phases:
-
Non-ambitious mode: the planner terminates as soon as it has found any implementation, no matter how expensive. (TODO: is that we will always find an implementation before the rule queue gets empty?)
-
Ambitious mode: the planner keeps applying rules as long as they continue to reduce the cost (with some criteria).
TODO: how new matches are added through firing a rule match?
The optimization process is divided into 4 phases: PRE_PROCESS_MDR, PRE_PROCESS, OPTIMIZE, and CLEANUP.
TODO: why the optimization process is divided into phases? Which rules are put in first phases and which rules are put last?
In the ambitious mode, the planner fires rules exhaustively (TODO is it really exhaustive?) to lower the cost. In order to limit the cost for the optimization process, the planner can be configured impatient, which adds some early termination criteria to prune less useful matches.
The impatient planner terminates the iteration within a phase when no improvements to the plan have been made within a number of iterations that is 1) 10% of the number of iterations necessary to first reach an implementable plan or 2) 25 iterations whichever is larger.

(づ。◕‿‿◕。)づ (◕‿◕✿)