public interface Optimizable extends Visitable
Modifier and Type | Method and Description |
---|---|
boolean |
considerSortAvoidancePath()
Check whether this optimizable's sort avoidance path should
be considered.
|
int |
convertAbsoluteToRelativeColumnPosition(int absolutePosition)
Convert an absolute to a relative 0-based column position.
|
CostEstimate |
estimateCost(OptimizablePredicateList predList,
ConglomerateDescriptor cd,
CostEstimate outerCost,
Optimizer optimizer,
RowOrdering rowOrdering)
Estimate the cost of scanning this Optimizable using the given
predicate list with the given conglomerate.
|
boolean |
feasibleJoinStrategy(OptimizablePredicateList predList,
Optimizer optimizer)
Is the current proposed join strategy for this optimizable feasible
given the predicate list?
|
boolean |
forUpdate()
Return true if this is the target table of an update
|
java.lang.String |
getBaseTableName()
Get the table name of this Optimizable.
|
AccessPath |
getBestAccessPath()
Get the best access path for this Optimizable.
|
AccessPath |
getBestSortAvoidancePath()
Get the best sort-avoidance path for this Optimizable.
|
AccessPath |
getCurrentAccessPath()
Get the current access path under consideration for this Optimizable
|
DataDictionary |
getDataDictionary()
Get the DataDictionary from this Optimizable.
|
java.lang.String |
getName()
Get the (exposed) name of this Optimizable
|
int |
getNumColumnsReturned()
Get the number of the number of columns returned by this Optimizable.
|
OptTrace |
getOptimizerTracer()
Get the optimizer tracer, if any
|
java.util.Properties |
getProperties()
Get the Properties list, if any, associated with this optimizable.
|
JBitSet |
getReferencedTableMap()
Get the map of referenced tables for this Optimizable.
|
int |
getResultSetNumber()
Get this Optimizable's result set number
|
TableDescriptor |
getTableDescriptor()
Get the table descriptor for this table (if any).
|
int |
getTableNumber()
Get this Optimizable's table number
|
AccessPath |
getTrulyTheBestAccessPath()
Get the best access path overall for this Optimizable.
|
int[] |
hashKeyColumns()
Return the hash key column numbers, for hash join strategy
|
boolean |
hasLargeObjectColumns()
Tell whether this Optimizable has any large object (LOB) columns.
|
boolean |
hasTableNumber()
Return true if this Optimizable has a table number
|
void |
initAccessPaths(Optimizer optimizer)
Init the access paths for this optimizable.
|
int |
initialCapacity()
Return the initial capacity of the hash table, for hash join strategy
|
boolean |
isBaseTable()
Tell whether this Optimizable represents a base table
|
boolean |
isCoveringIndex(ConglomerateDescriptor cd)
Return whether or not this is a covering index.
|
boolean |
isMaterializable()
Tell whether this Optimizable is materializable
|
boolean |
isOneRowScan()
Will the optimizable return at most 1 row per scan?
|
boolean |
isTargetTable()
Is the optimizable the target table of an update or delete?
|
boolean |
legalJoinOrder(JBitSet assignedTableMap)
Can this Optimizable appear at the current location in the join order.
|
float |
loadFactor()
Return the load factor of the hash table, for hash join strategy
|
int |
maxCapacity(JoinStrategy joinStrategy,
int maxMemoryPerTable)
Return the maximum capacity of the hash table, for hash join strategy
|
boolean |
memoryUsageOK(double rowCount,
int maxMemoryPerTable) |
Optimizable |
modifyAccessPath(JBitSet outerTables)
Modify the access path for this Optimizable, as necessary.
|
boolean |
nextAccessPath(Optimizer optimizer,
OptimizablePredicateList predList,
RowOrdering rowOrdering)
Choose the next access path to evaluate for this Optimizable.
|
CostEstimate |
optimizeIt(Optimizer optimizer,
OptimizablePredicateList predList,
CostEstimate outerCost,
RowOrdering rowOrdering)
Choose the best access path for this Optimizable.
|
boolean |
optimizerTracingIsOn()
Report whether optimizer tracing is on
|
void |
pullOptPredicates(OptimizablePredicateList optimizablePredicates)
Pull all the OptimizablePredicates from this Optimizable and put them
in the given OptimizablePredicateList.
|
boolean |
pushOptPredicate(OptimizablePredicate optimizablePredicate)
Push an OptimizablePredicate down, if this node accepts it.
|
void |
rememberAsBest(int planType,
Optimizer optimizer)
Remember the current access path as the best one (so far).
|
void |
rememberJoinStrategyAsBest(AccessPath ap)
Remember the current join strategy as the best one so far in this
join order.
|
void |
rememberSortAvoidancePath()
Mark this optimizable so that its sort avoidance path will be
considered.
|
void |
setHashKeyColumns(int[] columnNumbers)
Set the hash key column numbers, for hash join strategy
|
void |
setProperties(java.util.Properties tableProperties)
Set the Properties list for this optimizalbe.
|
void |
startOptimizing(Optimizer optimizer,
RowOrdering rowOrdering)
Begin the optimization process for this Optimizable.
|
boolean |
supportsMultipleInstantiations()
Tell whether this Optimizable can be instantiated multiple times
|
double |
uniqueJoin(OptimizablePredicateList predList)
Does this optimizable have a uniqueness condition on the
given predicate list, and if so, how many unique keys will be
returned per scan.
|
void |
updateBestPlanMap(short action,
java.lang.Object planKey)
When remembering "truly the best" access path for an Optimizable, we
have to keep track of which OptimizerImpl the "truly the best" access
is for.
|
void |
verifyProperties(DataDictionary dDictionary)
Verify that the Properties list with optimizer overrides, if specified, is valid
|
accept, addTag, taggedWith
boolean nextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) throws StandardException
optimizer
- Optimizer to use.predList
- The predicate list for this optimizable.
The optimizer always passes null, and it is up
to the optimizable object to pass along its
own predicate list, if appropriate, when delegating
this method.rowOrdering
- The row ordering for all the outer tables in
the join order. This method will add the ordering
of the next access path to the given RowOrdering.StandardException
- Thrown on errorCostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws StandardException
optimizer
- Optimizer to use.predList
- The predicate list to optimize againstouterCost
- The CostEstimate for the outer tables in the join order,
telling how many times this Optimizable will be scanned.rowOrdering
- The row ordering for all the tables in the
join order, including this one.StandardException
- Thrown on errorAccessPath getCurrentAccessPath()
AccessPath getBestAccessPath()
AccessPath getBestSortAvoidancePath()
AccessPath getTrulyTheBestAccessPath()
void rememberSortAvoidancePath()
boolean considerSortAvoidancePath()
void rememberJoinStrategyAsBest(AccessPath ap)
TableDescriptor getTableDescriptor()
JBitSet getReferencedTableMap()
boolean pushOptPredicate(OptimizablePredicate optimizablePredicate) throws StandardException
optimizablePredicate
- OptimizablePredicate to push down.StandardException
- Thrown on errorvoid pullOptPredicates(OptimizablePredicateList optimizablePredicates) throws StandardException
optimizablePredicates
- The list to put the pulled predicates
in.StandardException
- Thrown on errorOptimizable modifyAccessPath(JBitSet outerTables) throws StandardException
outerTables
- Bit map of the tables that are outer to this one
in the join order.StandardException
- Thrown on errorboolean isCoveringIndex(ConglomerateDescriptor cd) throws StandardException
cd
- ConglomerateDesriptor for index to considerStandardException
- Thrown on errorjava.util.Properties getProperties()
void setProperties(java.util.Properties tableProperties)
tableProperties
- The Properties list for this optimizable.void verifyProperties(DataDictionary dDictionary) throws StandardException
dDictionary
- The DataDictionary to use.StandardException
- Thrown on errorjava.lang.String getName() throws StandardException
StandardException
- Thrown on errorjava.lang.String getBaseTableName()
int convertAbsoluteToRelativeColumnPosition(int absolutePosition)
absolutePosition
- The absolute 0-based column position for the column.void updateBestPlanMap(short action, java.lang.Object planKey) throws StandardException
action
- Indicates whether we're adding, loading, or removing
a best plan for the OptimizerImpl/Optimizable.planKey
- Object to use as the map key when adding/looking up
a plan. If it is an instance of OptimizerImpl then it corresponds
to an outer query; otherwise it's some Optimizable above this
Optimizable that could potentially reject plans chosen by the
OptimizerImpl to which this Optimizable belongs.StandardException
void rememberAsBest(int planType, Optimizer optimizer) throws StandardException
planType
- The type of plan (one of Optimizer.NORMAL_PLAN
or Optimizer.SORT_AVOIDANCE_PLAN)optimizer
- The OptimizerImpl that is telling this Optimizable
to remember its current path as "truly the best".StandardException
- thrown on error.void startOptimizing(Optimizer optimizer, RowOrdering rowOrdering)
CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException
predList
- The predicate list to optimize againstcd
- The conglomerate descriptor to get the cost ofouterCost
- The estimated cost of the part of the plan outer
to this optimizable.optimizer
- The optimizer to use to help estimate the costrowOrdering
- The row ordering for all the tables in the
join order, including this one.StandardException
- Thrown on errorOptimizablePredicateList.classify(org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor)
boolean isBaseTable()
boolean isMaterializable() throws StandardException
StandardException
- Thrown on errorboolean supportsMultipleInstantiations()
boolean hasLargeObjectColumns()
int getResultSetNumber()
int getTableNumber()
boolean hasTableNumber()
boolean forUpdate()
int initialCapacity()
float loadFactor()
int[] hashKeyColumns()
void setHashKeyColumns(int[] columnNumbers)
boolean feasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer) throws StandardException
predList
- The predicate list that has been pushed down to
this optimizableoptimizer
- The optimizer to use.StandardException
- Thrown on errorboolean memoryUsageOK(double rowCount, int maxMemoryPerTable) throws StandardException
rowCount
- maxMemoryPerTable
- StandardException
- standard error policyint maxCapacity(JoinStrategy joinStrategy, int maxMemoryPerTable) throws StandardException
maxMemoryPerTable
- The maximum number of bytes to be used. Ignored if the user has set a maximum
number of rows for the Optimizable.StandardException
- Standard error policyboolean legalJoinOrder(JBitSet assignedTableMap)
assignedTableMap
- The tables that have been placed so far in the join order.DataDictionary getDataDictionary() throws StandardException
StandardException
- Thrown on errorboolean isTargetTable()
int getNumColumnsReturned()
boolean isOneRowScan() throws StandardException
StandardException
- Thrown on errorvoid initAccessPaths(Optimizer optimizer)
optimizer
- The optimizer being used.double uniqueJoin(OptimizablePredicateList predList) throws StandardException
predList
- The predicate list to checkStandardException
- Thrown on errorOptTrace getOptimizerTracer()
boolean optimizerTracingIsOn()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.