|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.iapi.sql.compile
Interface Optimizable

- public interface Optimizable
Optimizable provides services for optimizing a table in a query.
| Method Summary | |
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,
org.apache.derby.iapi.sql.dictionary.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 |
org.apache.derby.iapi.sql.dictionary.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. |
java.util.Properties |
getProperties()
Get the Properties list, if any, associated with this optimizalbe. |
org.apache.derby.iapi.util.JBitSet |
getReferencedTableMap()
Get the map of referenced tables for this Optimizable. |
int |
getResultSetNumber()
Get this Optimizable's result set number |
org.apache.derby.iapi.sql.dictionary.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 |
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(org.apache.derby.iapi.sql.dictionary.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(org.apache.derby.iapi.util.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(org.apache.derby.iapi.util.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. |
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)
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 |
verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary dDictionary)
Verify that the Properties list with optimizer overrides, if specified, is valid |
| Method Detail |
nextAccessPath
public boolean nextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) throws org.apache.derby.iapi.error.StandardException
- Choose the next access path to evaluate for this Optimizable.
optimizeIt
public CostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws org.apache.derby.iapi.error.StandardException
- Choose the best access path for this Optimizable.
getCurrentAccessPath
public AccessPath getCurrentAccessPath()
- Get the current access path under consideration for this Optimizable
getBestAccessPath
public AccessPath getBestAccessPath()
- Get the best access path for this Optimizable.
getBestSortAvoidancePath
public AccessPath getBestSortAvoidancePath()
- Get the best sort-avoidance path for this Optimizable.
getTrulyTheBestAccessPath
public AccessPath getTrulyTheBestAccessPath()
- Get the best access path overall for this Optimizable.
rememberSortAvoidancePath
public void rememberSortAvoidancePath()
- Mark this optimizable so that its sort avoidance path will be
considered.
considerSortAvoidancePath
public boolean considerSortAvoidancePath()
- Check whether this optimizable's sort avoidance path should
be considered.
rememberJoinStrategyAsBest
public void rememberJoinStrategyAsBest(AccessPath ap)
- Remember the current join strategy as the best one so far in this
join order.
getTableDescriptor
public org.apache.derby.iapi.sql.dictionary.TableDescriptor getTableDescriptor()
- Get the table descriptor for this table (if any). Only base tables
have table descriptors - for the rest of the optimizables, this
method returns null.
getReferencedTableMap
public org.apache.derby.iapi.util.JBitSet getReferencedTableMap()
- Get the map of referenced tables for this Optimizable.
pushOptPredicate
public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate) throws org.apache.derby.iapi.error.StandardException
- Push an OptimizablePredicate down, if this node accepts it.
pullOptPredicates
public void pullOptPredicates(OptimizablePredicateList optimizablePredicates) throws org.apache.derby.iapi.error.StandardException
- Pull all the OptimizablePredicates from this Optimizable and put them
in the given OptimizablePredicateList.
modifyAccessPath
public Optimizable modifyAccessPath(org.apache.derby.iapi.util.JBitSet outerTables) throws org.apache.derby.iapi.error.StandardException
- Modify the access path for this Optimizable, as necessary. This includes
things like adding a result set to translate from index rows to base rows
isCoveringIndex
public boolean isCoveringIndex(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd) throws org.apache.derby.iapi.error.StandardException
- Return whether or not this is a covering index. We expect to call this
during generation, after access path selection is complete.
getProperties
public java.util.Properties getProperties()
- Get the Properties list, if any, associated with this optimizalbe.
setProperties
public void setProperties(java.util.Properties tableProperties)
- Set the Properties list for this optimizalbe.
verifyProperties
public void verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary dDictionary) throws org.apache.derby.iapi.error.StandardException
- Verify that the Properties list with optimizer overrides, if specified, is valid
getName
public java.lang.String getName() throws org.apache.derby.iapi.error.StandardException
- Get the (exposed) name of this Optimizable
getBaseTableName
public java.lang.String getBaseTableName()
- Get the table name of this Optimizable. Only base tables have
table names (by the time we use this method, all views will have
been resolved).
convertAbsoluteToRelativeColumnPosition
public int convertAbsoluteToRelativeColumnPosition(int absolutePosition)
- Convert an absolute to a relative 0-based column position.
This is useful when generating qualifiers for partial rows
from the store.
rememberAsBest
public void rememberAsBest(int planType)
throws org.apache.derby.iapi.error.StandardException
- Remember the current access path as the best one (so far).
startOptimizing
public void startOptimizing(Optimizer optimizer, RowOrdering rowOrdering)
- Begin the optimization process for this Optimizable. This can be
called many times for an Optimizable while optimizing a query -
it will typically be called every time the Optimizable is placed
in a potential join order.
estimateCost
public CostEstimate estimateCost(OptimizablePredicateList predList, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws org.apache.derby.iapi.error.StandardException
- Estimate the cost of scanning this Optimizable using the given
predicate list with the given conglomerate. It is assumed that the
predicate list has already been classified. This cost estimate is
just for one scan, not for the life of the query.
isBaseTable
public boolean isBaseTable()
- Tell whether this Optimizable represents a base table
isMaterializable
public boolean isMaterializable()
throws org.apache.derby.iapi.error.StandardException
- Tell whether this Optimizable is materializable
supportsMultipleInstantiations
public boolean supportsMultipleInstantiations()
- Tell whether this Optimizable can be instantiated multiple times
getResultSetNumber
public int getResultSetNumber()
- Get this Optimizable's result set number
getTableNumber
public int getTableNumber()
- Get this Optimizable's table number
hasTableNumber
public boolean hasTableNumber()
- Return true if this Optimizable has a table number
forUpdate
public boolean forUpdate()
- Return true if this is the target table of an update
initialCapacity
public int initialCapacity()
- Return the initial capacity of the hash table, for hash join strategy
loadFactor
public float loadFactor()
- Return the load factor of the hash table, for hash join strategy
hashKeyColumns
public int[] hashKeyColumns()
- Return the hash key column numbers, for hash join strategy
setHashKeyColumns
public void setHashKeyColumns(int[] columnNumbers)
- Set the hash key column numbers, for hash join strategy
feasibleJoinStrategy
public boolean feasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer) throws org.apache.derby.iapi.error.StandardException
- Is the current proposed join strategy for this optimizable feasible
given the predicate list?
memoryUsageOK
public boolean memoryUsageOK(double rowCount,
int maxMemoryPerTable)
throws org.apache.derby.iapi.error.StandardException
maxCapacity
public int maxCapacity(JoinStrategy joinStrategy, int maxMemoryPerTable) throws org.apache.derby.iapi.error.StandardException
- Return the maximum capacity of the hash table, for hash join strategy
legalJoinOrder
public boolean legalJoinOrder(org.apache.derby.iapi.util.JBitSet assignedTableMap)
- Can this Optimizable appear at the current location in the join order.
In other words, have the Optimizable's dependencies been satisfied?
getDataDictionary
public org.apache.derby.iapi.sql.dictionary.DataDictionary getDataDictionary() throws org.apache.derby.iapi.error.StandardException
- Get the DataDictionary from this Optimizable. This is useful for code generation
because we need to get the constraint name if scanning a back index so that
RunTimeStatistics can display the correct info.
isTargetTable
public boolean isTargetTable()
- Is the optimizable the target table of an update or delete?
getNumColumnsReturned
public int getNumColumnsReturned()
- Get the number of the number of columns returned by this Optimizable.
isOneRowScan
public boolean isOneRowScan()
throws org.apache.derby.iapi.error.StandardException
- Will the optimizable return at most 1 row per scan?
initAccessPaths
public void initAccessPaths(Optimizer optimizer)
- Init the access paths for this optimizable.
uniqueJoin
public double uniqueJoin(OptimizablePredicateList predList) throws org.apache.derby.iapi.error.StandardException
- Does this optimizable have a uniqueness condition on the
given predicate list, and if so, how many unique keys will be
returned per scan.
|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC