public interface Optimizer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JOIN_ORDER_OPTIMIZATION
Property name for controlling whether to do join order optimization.
|
static int |
MAX_DYNAMIC_MATERIALIZED_ROWS
Maximum size of dynamically created materialized rows.
|
static java.lang.String |
MAX_MEMORY_PER_TABLE
Property name for controlling the maximum size of memory (in KB)
the optimizer can use for each table.
|
static java.lang.String |
MODULE
Module name for the monitor's module locating system.
|
static java.lang.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.
|
static int |
NORMAL_PLAN
Indicates a "normal" plan that is not optimized to do sort avoidance
|
static java.lang.String |
RULE_BASED_OPTIMIZATION
Property name for controlling whether to do rule-based optimization,
as opposed to cost-based optimization.
|
static int |
SORT_AVOIDANCE_PLAN
Indicates a sort-avoidance plan
|
static java.lang.String |
USE_STATISTICS
Property name for disabling statistics use for all queries.
|
Modifier and Type | Method and Description |
---|---|
void |
considerCost(Optimizable optimizable,
OptimizablePredicateList predList,
CostEstimate estimatedCost,
CostEstimate outerCost)
Consider the cost of the given optimizable.
|
void |
costOptimizable(Optimizable optimizable,
TableDescriptor td,
ConglomerateDescriptor cd,
OptimizablePredicateList predList,
CostEstimate outerCost)
Cost the current Optimizable with the specified OPL.
|
void |
costPermutation()
Cost the current permutation.
|
DataDictionary |
getDataDictionary()
Return the DataDictionary that the Optimizer is using.
|
CostEstimate |
getFinalCost()
Get the final estimated cost of the optimized query.
|
JoinStrategy |
getJoinStrategy(int whichStrategy)
Gets a join strategy by number (zero-based).
|
JoinStrategy |
getJoinStrategy(java.lang.String whichStrategy)
Gets a join strategy by name.
|
int |
getLevel()
Get the level of this optimizer.
|
int |
getMaxMemoryPerTable() |
boolean |
getNextDecoratedPermutation()
Iterate through the "decorated permutations", returning false when they
are exhausted.
|
boolean |
getNextPermutation()
Iterate through the permutations, returning false when the permutations
are exhausted.
|
int |
getNumberOfJoinStrategies()
Get the number of join strategies supported by this optimizer.
|
Optimizable |
getOptimizable(int idx)
Get the ith (0-based) Optimizable being considered by this Optimizer.
|
int |
getOptimizableCount()
Get the number of optimizables being considered by this Optimizer.
|
CostEstimate |
getOptimizedCost()
Get the estimated cost of the optimized query
|
void |
modifyAccessPaths()
Modify the access path for each Optimizable, as necessary.
|
void |
prepForNextRound()
Prepare for another round of optimization.
|
void |
setOuterRows(double outerRowCount)
Set the estimated number of outer rows - good for optimizing nested
optimizables like subqueries and join nodes.
|
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.
|
double |
uniqueJoinWithOuterTable(OptimizablePredicateList 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.
|
void |
updateBestPlanMaps(short action,
java.lang.Object 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.
|
boolean |
useStatistics()
If statistics should be considered by the optimizer while optimizing
a query.
|
static final java.lang.String MODULE
static final java.lang.String JOIN_ORDER_OPTIMIZATION
static final java.lang.String RULE_BASED_OPTIMIZATION
static final java.lang.String NO_TIMEOUT
static final java.lang.String MAX_MEMORY_PER_TABLE
static final int MAX_DYNAMIC_MATERIALIZED_ROWS
static final java.lang.String USE_STATISTICS
static final int NORMAL_PLAN
static final int SORT_AVOIDANCE_PLAN
boolean getNextPermutation() throws StandardException
StandardException
- Thrown on errorboolean getNextDecoratedPermutation() throws StandardException
StandardException
- Thrown on errorvoid costPermutation() throws StandardException
StandardException
- Thrown on errorvoid costOptimizable(Optimizable optimizable, TableDescriptor td, ConglomerateDescriptor cd, OptimizablePredicateList predList, CostEstimate outerCost) throws StandardException
optimizable
- The Optimizabletd
- TableDescriptor of the Optimizablecd
- The ConglomerateDescriptor for the conglom to cost
(This should change to an object to represent
access paths, but for now this is OK).predList
- The OptimizablePredicateList to applyouterCost
- The cost of the tables outer to the one being
optimizer - tells how many outer rows there are.StandardException
- Thrown on errorvoid considerCost(Optimizable optimizable, OptimizablePredicateList predList, CostEstimate estimatedCost, CostEstimate outerCost) throws StandardException
optimizable
- The OptimizablepredList
- The OptimizablePredicateList to applyestimatedCost
- The estimated cost of the given optimizableouterCost
- The cost of the tables outer to the one being
optimizer - tells how many outer rows there are.StandardException
- Thrown on errorDataDictionary getDataDictionary()
void modifyAccessPaths() throws StandardException
StandardException
- Thrown on errorCostEstimate getOptimizedCost()
CostEstimate getFinalCost()
void prepForNextRound()
void setOuterRows(double outerRowCount)
int getNumberOfJoinStrategies()
int tableLockThreshold()
JoinStrategy getJoinStrategy(int whichStrategy)
JoinStrategy getJoinStrategy(java.lang.String whichStrategy)
int getLevel()
double uniqueJoinWithOuterTable(OptimizablePredicateList predList) throws StandardException
predList
- The predicate list to checkStandardException
- Thrown on errorboolean useStatistics()
USE_STATISTICS
int getMaxMemoryPerTable()
int getOptimizableCount()
Optimizable getOptimizable(int idx)
void updateBestPlanMaps(short action, java.lang.Object planKey) throws StandardException
action
- Indicates whether to add, load, or remove the planplanKey
- 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.StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.