| org.apache.derby.iapi.sql.compile.JoinStrategy
All known Subclasses: org.apache.derby.impl.sql.compile.BaseJoinStrategy,
JoinStrategy | public interface JoinStrategy (Code) | | A JoinStrategy represents a strategy like nested loop, hash join,
merge join, etc. It tells the optimizer whether the strategy is
feasible in a given situation, how much the strategy costs, whether
the strategy requires the data from the source result sets to be ordered,
etc.
|
Method Summary | |
boolean | bulkFetchOK() | void | divideUpPredicateLists(Optimizable innerTable, OptimizablePredicateList originalRestrictionList, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, OptimizablePredicateList requalificationRestrictionList, DataDictionary dd) Divide up the predicates into different lists for different phases
of the operation. | public boolean | doesMaterialization() | void | estimateCost(Optimizable innerTable, OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, CostEstimate costEstimate) Get the estimated cost for the join. | boolean | feasible(Optimizable innerTable, OptimizablePredicateList predList, Optimizer optimizer) | OptimizablePredicateList | getBasePredicates(OptimizablePredicateList predList, OptimizablePredicateList basePredicates, Optimizable innerTable) Get the base predicates for this join strategy. | String | getName() | int | getScanArgs(TransactionController tc, MethodBuilder mb, Optimizable innerTable, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, ExpressionClassBuilderInterface acb, int bulkFetch, MethodBuilder resultRowAllocator, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int maxMemoryPerTable) Get the appropriate arguments to the scan for this type of join. | String | halfOuterJoinResultSetMethodName() | boolean | ignoreBulkFetch() | public boolean | isHashJoin() | String | joinResultSetMethodName() | public int | maxCapacity(int userSpecifiedCapacity, int maxMemoryPerTable, double perRowUsage) | boolean | multiplyBaseCostByOuterRows() Returns true if the base cost of scanning the conglomerate should be
multiplied by the number of outer rows. | double | nonBasePredicateSelectivity(Optimizable innerTable, OptimizablePredicateList predList) Get the extra selectivity of the non-base predicates (those that were
left in the predicate list by getBasePredicates() that are not
applied to the scan of the base conglomerate.
NOTE: For some types of join strategy, it may not remove any predicates
from the original predicate list. | void | putBasePredicates(OptimizablePredicateList predList, OptimizablePredicateList basePredicates) Put back and base predicates that were removed from the list by
getBasePredicates (see above). | String | resultSetMethodName(boolean bulkFetch) | int | scanCostType() |
bulkFetchOK | boolean bulkFetchOK()(Code) | | Is it OK to use bulk fetch with this join strategy?
|
divideUpPredicateLists | void divideUpPredicateLists(Optimizable innerTable, OptimizablePredicateList originalRestrictionList, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, OptimizablePredicateList requalificationRestrictionList, DataDictionary dd) throws StandardException(Code) | | Divide up the predicates into different lists for different phases
of the operation. When this method is called, all of the predicates
will be in restrictionList. The effect of this method is to
remove all of the predicates from restrictionList except those that
will be pushed down to the store as start/stop predicates or
Qualifiers. The remaining predicates will be put into
nonBaseTableRestrictionList.
All predicate lists will be ordered as necessary for use with
the conglomerate.
Some operations (like hash join) materialize results, and so
require requalification of rows when doing a non-covering index
scan. The predicates to use for requalification are copied into
baseTableRestrictionList.
Parameters: innerTable - The inner table of the join Parameters: originalRestrictionList - Initially contains all predicates.This method removes predicates fromthis list and moves them to otherlists, as appropriate. Parameters: storeRestrictionList - To be filled in with predicates tobe pushed down to store. Parameters: nonStoreRestrictionList - To be filled in with predicatesthat are not pushed down to thestore. Parameters: requalificationRestrictionList - Copy of predicates used tore-qualify rows, if necessary. Parameters: dd - The DataDictionary exception: StandardException - Thrown on error |
doesMaterialization | public boolean doesMaterialization()(Code) | | Is materialization built in to the join strategy?
Whether or not materialization is built in to the join strategy |
estimateCost | void estimateCost(Optimizable innerTable, OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, CostEstimate costEstimate) throws StandardException(Code) | | Get the estimated cost for the join.
Parameters: predList - The predicate list for the join Parameters: innerTable - The inner table to join with Parameters: cd - The conglomerate descriptor (if appropriate) to getthe cost of Parameters: outerCost - The estimated cost of the part of the plan outerto the inner table Parameters: optimizer - The optimizer to use to help estimate the cost Parameters: costEstimate - The estimated cost of doing a single scan of theinner table, to be filled in with the cost ofdoing the join. exception: StandardException - Thrown on error |
feasible | boolean feasible(Optimizable innerTable, OptimizablePredicateList predList, Optimizer optimizer) throws StandardException(Code) | | Is this join strategy feasible under the circumstances?
Parameters: innerTable - The inner table of the join Parameters: predList - The predicateList for the join Parameters: optimizer - The optimizer to use true means the strategy is feasible, false means it isn't exception: StandardException - Thrown on error |
getBasePredicates | OptimizablePredicateList getBasePredicates(OptimizablePredicateList predList, OptimizablePredicateList basePredicates, Optimizable innerTable) throws StandardException(Code) | | Get the base predicates for this join strategy. The base predicates
are the ones that can be used while scanning the table. For some
join strategies (for example, nested loop), all predicates are base
predicates. For other join strategies (for example, hash join),
the base predicates are those that involve comparisons with constant
expressions.
Also, order the base predicates according to the order in the
proposed conglomerate descriptor for the inner table.
Parameters: predList - The predicate list to pull from. Parameters: basePredicates - The list to put the base predicates in. Parameters: innerTable - The inner table of the join The base predicate list. If no predicates are pulled,it may return the source predList without doing anything. exception: StandardException - Thrown on error |
getName | String getName()(Code) | | Get the name of this join strategy
|
getScanArgs | int getScanArgs(TransactionController tc, MethodBuilder mb, Optimizable innerTable, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, ExpressionClassBuilderInterface acb, int bulkFetch, MethodBuilder resultRowAllocator, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int maxMemoryPerTable) throws StandardException(Code) | | Get the appropriate arguments to the scan for this type of join.
Parameters: tc - The TransactionController Parameters: mb - The method to generate the arguments in Parameters: innerTable - The inner table of the join Parameters: storeRestrictionList - The predicate list to be evaluated in thestore Parameters: nonStoreRestrictionList - The predicate list to be evaluatedoutside of the store Parameters: acb - The expression class builder for the activation classwe're building Parameters: bulkFetch - The amount of bulk fetch to do Parameters: resultRowAllocator - A completed method to allocate the result row Parameters: colRefItem - The item number of the column reference bit map Parameters: lockMode - The lock mode to use when scanning the table(see TransactionController). Parameters: tableLocked - Whether or not the table is marked (in sys.systables)as always using table locking Parameters: isolationLevel - Isolation level specified (or not) for scans Parameters: maxMemoryPerTable - Max memory per table Count of the expressions pushed to use as the parameters to theresult set for the inner table exception: StandardException - Thrown on error |
halfOuterJoinResultSetMethodName | String halfOuterJoinResultSetMethodName()(Code) | | Get the name of the join result set method for the half outerjoin
|
ignoreBulkFetch | boolean ignoreBulkFetch()(Code) | | Should we just ignore bulk fetch with this join strategy?
|
isHashJoin | public boolean isHashJoin()(Code) | | Is this a form of hash join?
Whether or not this strategy is a formof hash join. |
joinResultSetMethodName | String joinResultSetMethodName()(Code) | | Get the name of the join result set method for the join
|
maxCapacity | public int maxCapacity(int userSpecifiedCapacity, int maxMemoryPerTable, double perRowUsage)(Code) | | Parameters: userSpecifiedCapacity - Parameters: maxMemoryPerTable - maximum number of bytes per table Parameters: perRowUsage - number of bytes per row The maximum number of rows that can be handled by this join strategy |
multiplyBaseCostByOuterRows | boolean multiplyBaseCostByOuterRows()(Code) | | Returns true if the base cost of scanning the conglomerate should be
multiplied by the number of outer rows.
|
nonBasePredicateSelectivity | double nonBasePredicateSelectivity(Optimizable innerTable, OptimizablePredicateList predList) throws StandardException(Code) | | Get the extra selectivity of the non-base predicates (those that were
left in the predicate list by getBasePredicates() that are not
applied to the scan of the base conglomerate.
NOTE: For some types of join strategy, it may not remove any predicates
from the original predicate list. The join strategy is expected to
know when it does this, and to return 1.0 as the extra selectivity
in these cases.
Parameters: innerTable - The inner table of the join. Parameters: predList - The original predicate list that was passed togetBasePredicates(), from which some base predicatesmay have been pulled. The extra selectivity due to non-base predicates |
putBasePredicates | void putBasePredicates(OptimizablePredicateList predList, OptimizablePredicateList basePredicates) throws StandardException(Code) | | Put back and base predicates that were removed from the list by
getBasePredicates (see above).
NOTE: Those join strategies that treat all predicates as base
predicates may treat the get and put methods as no-ops.
Parameters: predList - The list of predicates to put the base predicatesback in. Parameters: basePredicates - The base predicates to put back in the list. exception: StandardException - Thrown on error |
resultSetMethodName | String resultSetMethodName(boolean bulkFetch)(Code) | | Get the name of the result set method for base table scans
Parameters: bulkFetch - True means bulk fetch is being done on the innertable |
scanCostType | int scanCostType()(Code) | | Get the costing type, for use with StoreCostController.getScanCost
|
|
|