Resolve
o Need to figure out what to do about subqueries, figuring out their attachment points and how to communicate them back to the caller.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | JOIN_ORDER_OPTIMIZATION
Property name for controlling whether to do join order optimization. |
| public static final int | MAX_DYNAMIC_MATERIALIZED_ROWS
Maximum size of dynamically created materialized rows. |
| public static final String | MAX_MEMORY_PER_TABLE
Property name for controlling the maximum size of memory (in KB) the optimizer can use for each table. |
| public static final String | MODULE
Module name for the monitor's module locating system. |
| public static final String | NO_TIMEOUT
Property name for controlling whether the optimizer ever times out while optimizing a query and goes with the best plan so far. |
| public static final int | NORMAL_PLAN
Indicates a "normal" plan that is not optimized to do sort avoidance |
| public static final String | RULE_BASED_OPTIMIZATION
Property name for controlling whether to do rule-based optimization, as opposed to cost-based optimization. |
| public static final int | SORT_AVOIDANCE_PLAN
Indicates a sort-avoidance plan |
| public static final String | USE_STATISTICS
Property name for disabling statistics use for all queries. |
| Modifier and Type | Method and Description |
|---|---|
| public void | considerCost(Optimizable
The Optimizable optimizable, OptimizablePredicateList The OptimizablePredicateList to apply predList, CostEstimate The estimated cost of the given optimizable estimatedCost, CostEstimate The cost of the tables outer to the one being
optimizer - tells how many outer rows there are. outerCost)Consider the cost of the given optimizable. |
| public void | costOptimizable(Optimizable
The Optimizable optimizable, TableDescriptor TableDescriptor of the Optimizable td, ConglomerateDescriptor The ConglomerateDescriptor for the conglom to cost
(This should change to an object to represent
access paths, but for now this is OK). cd, OptimizablePredicateList The OptimizablePredicateList to apply predList, CostEstimate The cost of the tables outer to the one being
optimizer - tells how many outer rows there are. outerCost)Cost the current Optimizable with the specified OPL. |
| public void | |
| public DataDictionary | Returns: DataDictionary DataDictionary that the Optimizer is using.Return the DataDictionary that the Optimizer is using. |
| public CostEstimate | |
| public JoinStrategy | |
| public JoinStrategy | |
| public int | |
| public int | |
| public boolean | Returns: boolean True - An optimizable decorated permutation remains. False - Decorated permutations are exhausted.Iterate through the "decorated permutations", returning false when they are exhausted. |
| public boolean | Returns: boolean True - An optimizable permutation remains. False - Permutations are exhausted.Iterate through the permutations, returning false when the permutations are exhausted. |
| public int | |
| public Optimizable | |
| public int | |
| public CostEstimate | |
| public void | |
| public void | |
| public void | setOuterRows(double outerRowCount)
Set the estimated number of outer rows - good for optimizing nested optimizables like subqueries and join nodes. |
| public int | tableLockThreshold()
Get the maximum number of estimated rows touched in a table before we decide to open the table with table locking (as opposed to row locking. |
| public double | Returns: <= 0 means there is no uniqueness condition > 0 means there is a uniqueness condition on an outer table, and the return value is the reciprocal of the maximum number of times the optimizer estimates that each unique key will be returned. For example, 0.5 means the optimizer thinks each distinct join key will be returned at most twice.The predicate list to check predList)Tells whether any of the tables outer to the current one has a uniqueness condition on the given predicate list, and if so, how many times each unique key can be seen by the current table. |
| public void | updateBestPlanMaps(short
Indicates whether to add, load, or remove the plan action, Object Object to use as the map key when adding/looking up
a plan. If this is an instance of Optimizer then it corresponds
to an outer query; otherwise it's some Optimizable above this
Optimizer that could potentially reject plans chosen by this
Optimizer. planKey)Process (i.e. add, load, or remove) current best join order as the best one for some outer query or ancestor node, represented by another Optimizer or an instance of FromTable, respectively. |
| public boolean |
| JOIN_ORDER_OPTIMIZATION | back to summary |
|---|---|
| public static final String JOIN_ORDER_OPTIMIZATION Property name for controlling whether to do join order optimization. | |
| MAX_DYNAMIC_MATERIALIZED_ROWS | back to summary |
|---|---|
| public static final int MAX_DYNAMIC_MATERIALIZED_ROWS Maximum size of dynamically created materialized rows. Caching large results use lot of memory and can cause stack overflow. See DERBY-634 | |
| MAX_MEMORY_PER_TABLE | back to summary |
|---|---|
| public static final String MAX_MEMORY_PER_TABLE Property name for controlling the maximum size of memory (in KB) the optimizer can use for each table. If an access path takes memory larger than that size for a table, the access path is skipped. Default is 1024 (KB). | |
| MODULE | back to summary |
|---|---|
| public static final String MODULE Module name for the monitor's module locating system. | |
| NO_TIMEOUT | back to summary |
|---|---|
| public static final String NO_TIMEOUT Property name for controlling whether the optimizer ever times out while optimizing a query and goes with the best plan so far. | |
| NORMAL_PLAN | back to summary |
|---|---|
| public static final int NORMAL_PLAN Indicates a "normal" plan that is not optimized to do sort avoidance | |
| RULE_BASED_OPTIMIZATION | back to summary |
|---|---|
| public static final String RULE_BASED_OPTIMIZATION Property name for controlling whether to do rule-based optimization, as opposed to cost-based optimization. | |
| SORT_AVOIDANCE_PLAN | back to summary |
|---|---|
| public static final int SORT_AVOIDANCE_PLAN Indicates a sort-avoidance plan | |
| USE_STATISTICS | back to summary |
|---|---|
| public static final String USE_STATISTICS Property name for disabling statistics use for all queries. | |
| considerCost | back to summary |
|---|---|
| public void considerCost(Optimizable optimizable, OptimizablePredicateList predList, CostEstimate estimatedCost, CostEstimate outerCost) throws StandardException Consider the cost of the given optimizable. This method is like costOptimizable, above, but it is used when the Optimizable does not need help from the optimizer in costing the Optimizable (in practice, all Optimizables except FromBaseTable use this method. Caller is responsible for pushing all predicates which can be evaluated prior to costing.
| |
| costOptimizable | back to summary |
|---|---|
| public void costOptimizable(Optimizable optimizable, TableDescriptor td, ConglomerateDescriptor cd, OptimizablePredicateList predList, CostEstimate outerCost) throws StandardException Cost the current Optimizable with the specified OPL. Caller is responsible for pushing all predicates which can be evaluated prior to costing.
| |
| costPermutation | back to summary |
|---|---|
| public void costPermutation() throws StandardException Cost the current permutation. Caller is responsible for pushing all predicates which can be evaluated prior to costing.
| |
| getDataDictionary | back to summary |
|---|---|
| public DataDictionary getDataDictionary() Return the DataDictionary that the Optimizer is using. This is useful when an Optimizable needs to call optimize() on a child ResultSetNode.
| |
| getFinalCost | back to summary |
|---|---|
| public CostEstimate getFinalCost() Get the final estimated cost of the optimized query. This should be the cost that corresponds to the best overall join order chosen by the optimizer, and thus this method should only be called after optimization is complete (i.e. when modifying access paths). | |
| getJoinStrategy | back to summary |
|---|---|
| public JoinStrategy getJoinStrategy(int whichStrategy) Gets a join strategy by number (zero-based). | |
| getJoinStrategy | back to summary |
|---|---|
| public JoinStrategy getJoinStrategy(String whichStrategy) Gets a join strategy by name. Returns null if not found. The look-up is case-insensitive. | |
| getLevel | back to summary |
|---|---|
| public int getLevel() Get the level of this optimizer.
| |
| getMaxMemoryPerTable | back to summary |
|---|---|
public int getMaxMemoryPerTable()
| |
| getNextDecoratedPermutation | back to summary |
|---|---|
| public boolean getNextDecoratedPermutation() throws StandardException Iterate through the "decorated permutations", returning false when they are exhausted. NOTE - Implementers are responsible for hiding tree pruning of access methods behind this method call.
| |
| getNextPermutation | back to summary |
|---|---|
| public boolean getNextPermutation() throws StandardException Iterate through the permutations, returning false when the permutations are exhausted. NOTE - Implementers are responsible for hiding tree pruning of permutations behind this method call.
| |
| getNumberOfJoinStrategies | back to summary |
|---|---|
| public int getNumberOfJoinStrategies() Get the number of join strategies supported by this optimizer. | |
| getOptimizable | back to summary |
|---|---|
| public Optimizable getOptimizable(int idx) Get the ith (0-based) Optimizable being considered by this Optimizer. | |
| getOptimizableCount | back to summary |
|---|---|
| public int getOptimizableCount() Get the number of optimizables being considered by this Optimizer. | |
| getOptimizedCost | back to summary |
|---|---|
| public CostEstimate getOptimizedCost() Get the estimated cost of the optimized query | |
| modifyAccessPaths | back to summary |
|---|---|
| public void modifyAccessPaths() throws StandardException Modify the access path for each Optimizable, as necessary. This includes things like adding result sets to translate from index rows to base rows.
| |
| prepForNextRound | back to summary |
|---|---|
| public void prepForNextRound() Prepare for another round of optimization. This method is called before every "round" of optimization, where we define a "round" to be the period between the last time a call to getOptimizer() (on either a ResultSetNode or an OptimizerFactory) returned _this_ Optimizer and the time a call to this Optimizer's getNextPermutation() method returns FALSE. Any re-initialization of state that is required before each round should be done in this method. | |
| setOuterRows | back to summary |
|---|---|
| public void setOuterRows(double outerRowCount) Set the estimated number of outer rows - good for optimizing nested optimizables like subqueries and join nodes. | |
| tableLockThreshold | back to summary |
|---|---|
| public int tableLockThreshold() Get the maximum number of estimated rows touched in a table before we decide to open the table with table locking (as opposed to row locking. | |
| uniqueJoinWithOuterTable | back to summary |
|---|---|
| public double uniqueJoinWithOuterTable(OptimizablePredicateList predList) throws StandardException Tells whether any of the tables outer to the current one has a uniqueness condition on the given predicate list, and if so, how many times each unique key can be seen by the current table.
| |
| updateBestPlanMaps | back to summary |
|---|---|
| public void updateBestPlanMaps(short action, Object planKey) throws StandardException Process (i.e. add, load, or remove) current best join order as the best one for some outer query or ancestor node, represented by another Optimizer or an instance of FromTable, respectively. Then iterate through our optimizableList and tell each Optimizable to do the same. See Optimizable.updateBestPlan() for more on why this is necessary.
| |
| useStatistics | back to summary |
|---|---|
| public boolean useStatistics() If statistics should be considered by the optimizer while optimizing a query. The user may disable the use of statistics by setting the property derby.optimizer.useStatistics or by using the property useStatistics in a query.
| |