org.apache.derby.impl.sql.compile
Class IntersectOrExceptNode
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.ResultSetNode
-
- org.apache.derby.impl.sql.compile.IntersectOrExceptNode
-
- All Implemented Interfaces:
- Optimizable, Visitable
public class IntersectOrExceptNode extends ResultSetNode
A IntersectOrExceptNode represents an INTERSECT or EXCEPT DML statement.
-
-
Field Summary
Fields Modifier and Type Field and Description static intEXCEPT_OPstatic intINTERSECT_OP
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidbindExpressions(org.apache.derby.impl.sql.compile.FromList fromList)Bind the expressions under this TableOperatorNode.booleanconsiderSortAvoidancePath()Check whether this optimizable's sort avoidance path should be considered.intconvertAbsoluteToRelativeColumnPosition(int absolutePosition)Convert an absolute to a relative 0-based column position.CostEstimateestimateCost(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.booleanfeasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer)Is the current proposed join strategy for this optimizable feasible given the predicate list?booleanforUpdate()Return true if this is the target table of an updatejava.lang.StringgetBaseTableName()Get the table name of this Optimizable.AccessPathgetBestAccessPath()Get the best access path for this Optimizable.AccessPathgetBestSortAvoidancePath()Get the best sort-avoidance path for this Optimizable.java.lang.StringgetCorrelationName()Get this table's correlation name, if any.AccessPathgetCurrentAccessPath()Get the current access path under consideration for this Optimizablejava.lang.StringgetName()Get the (exposed) name of this OptimizableintgetNumColumnsReturned()Get the number of the number of columns returned by this Optimizable.java.util.PropertiesgetProperties()Get the Properties list, if any, associated with this optimizable.TableDescriptorgetTableDescriptor()Get the table descriptor for this table (if any).intgetTableNumber()Get this Optimizable's table numberAccessPathgetTrulyTheBestAccessPath()Get the best access path overall for this Optimizable.int[]hashKeyColumns()Return the hash key column numbers, for hash join strategybooleanhasLargeObjectColumns()Check if any columns containing large objects (BLOBs or CLOBs) are referenced in this table.booleanhasTableNumber()Return true if this Optimizable has a table numbervoidinitAccessPaths(Optimizer optimizer)Init the access paths for this optimizable.intinitialCapacity()Return the initial capacity of the hash table, for hash join strategybooleanisBaseTable()Tell whether this Optimizable represents a base tablebooleanisCoveringIndex(ConglomerateDescriptor cd)Return whether or not this is a covering index.booleanisMaterializable()Tell whether this Optimizable is materializablebooleanisOneRowScan()Will the optimizable return at most 1 row per scan?booleanisTargetTable()Is the optimizable the target table of an update or delete?booleanlegalJoinOrder(JBitSet assignedTableMap)Can this Optimizable appear at the current location in the join order.floatloadFactor()Return the load factor of the hash table, for hash join strategyintmaxCapacity(JoinStrategy joinStrategy, int maxMemoryPerTable)Return the maximum capacity of the hash table, for hash join strategybooleanmemoryUsageOK(double rowCount, int maxMemoryPerTable)OptimizablemodifyAccessPath(JBitSet outerTables)Modify the access path for this Optimizable, as necessary.OptimizablemodifyAccessPath(JBitSet outerTables, org.apache.derby.impl.sql.compile.PredicateList predList)booleannextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering)Choose the next access path to evaluate for this Optimizable.CostEstimateoptimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering)Choose the best access path for this Optimizable.voidpullOptPredicates(OptimizablePredicateList optimizablePredicates)Pull all the OptimizablePredicates from this Optimizable and put them in the given OptimizablePredicateList.booleanpushOptPredicate(OptimizablePredicate optimizablePredicate)Push an OptimizablePredicate down, if this node accepts it.voidpushQueryExpressionSuffix()Set up a new level for order by and fetch/offset clauses.booleanreferencesSessionSchema()Return true if the node references SESSION schema tables (temporary or permanent)voidrememberAsBest(int planType, Optimizer optimizer)Remember the current access path as the best one (so far).voidrememberJoinStrategyAsBest(AccessPath ap)Remember the current join strategy as the best one so far in this join order.voidrememberSortAvoidancePath()Mark this optimizable so that its sort avoidance path will be considered.voidsetHashKeyColumns(int[] columnNumbers)Set the hash key column numbers, for hash join strategyvoidsetProperties(java.util.Properties tableProperties)Set the Properties list for this optimizalbe.voidstartOptimizing(Optimizer optimizer, RowOrdering rowOrdering)Begin the optimization process for this Optimizable.booleansupportsMultipleInstantiations()Tell whether this Optimizable can be instantiated multiple timesjava.lang.StringtoString()Convert this object to a String.doubleuniqueJoin(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.voidupdateBestPlanMap(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.voidverifyProperties(DataDictionary dDictionary)Verify that the Properties list with optimizer overrides, if specified, is valid-
Methods inherited from class org.apache.derby.impl.sql.compile.ResultSetNode
getReferencedTableMap, getResultSetNumber, makeResultDescription, parseDefault
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, createTypeDependency, getBeginOffset, getDataDictionary, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getUDTDesc, isAtomic, makeConstantAction, makeTableName, makeTableName, optimizerTracingIsOn, orReliability, setBeginOffset, setEndOffset, taggedWith, treePrint
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.derby.iapi.sql.compile.Optimizable
getDataDictionary, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOn
-
Methods inherited from interface org.apache.derby.iapi.sql.compile.Visitable
accept, addTag, taggedWith
-
-
-
-
Field Detail
-
INTERSECT_OP
public static final int INTERSECT_OP
- See Also:
- Constant Field Values
-
EXCEPT_OP
public static final int EXCEPT_OP
- See Also:
- Constant Field Values
-
-
Method Detail
-
estimateCost
public CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException
Description copied from interface:OptimizableEstimate 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.- Specified by:
estimateCostin interfaceOptimizable- Parameters:
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.- Returns:
- The estimated cost of doing the scan
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.estimateCost(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor, org.apache.derby.iapi.sql.compile.CostEstimate, org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.RowOrdering)
-
modifyAccessPath
public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
Description copied from interface:OptimizableModify the access path for this Optimizable, as necessary. This includes things like adding a result set to translate from index rows to base rows- Specified by:
modifyAccessPathin interfaceOptimizable- Parameters:
outerTables- Bit map of the tables that are outer to this one in the join order.- Returns:
- The (potentially new) Optimizable at the top of the tree.
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)
-
modifyAccessPath
public Optimizable modifyAccessPath(JBitSet outerTables, org.apache.derby.impl.sql.compile.PredicateList predList) throws StandardException
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)
-
pushOptPredicate
public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate) throws StandardException
Description copied from interface:OptimizablePush an OptimizablePredicate down, if this node accepts it.- Specified by:
pushOptPredicatein interfaceOptimizable- Parameters:
optimizablePredicate- OptimizablePredicate to push down.- Returns:
- Whether or not the predicate was pushed down.
- Throws:
StandardException- Thrown on error- See Also:
Take a predicate and push it down to both the left AND right result sets. Return "true" if we successfully pushed it to both sides, and "false" otherwise. The assumption is that if we return "true", the caller will take the predicate and remove it from its own list of predicates to evaluate; if we return false, then the predicate will be evaluated at the level of the caller. So returning "false" means that the left and right result sets for this node will be fully returned, and then the predicate will be evaluated against theof those result sets (as of DERBY-805, the only set operator calling this method is UnionNode). If we can push the predicate down to both children, though, we can evaluate it closer to store, which means that each child result set returns only the correctly qualified rows, and thus the calling set operator will have a smaller result set on which to operate, which can boost performance. That said, if we can't push the predicate to _both_ sides, we don't push it at all. The reason is that if we push to one side but not to the other, we would have to ask the question of whether we should return "true" (meaning that the predicate would be removed from the caller's list and thus would _not_ be evaluated at the level) or "false" (meaning that the caller would keep the predicate and evaluate it at the level). Depending on the query in question, both answers could end up returning incorrect results. For example, if we push it to the right but not to the left, then leave it in the caller's list, the optimizer for the caller might decide to use the predicate to do a hash join with some outer result set (if the predicate is an equijoin predicate). That would result in materialization of the calling node and of its children--but since we pushed a predicate that depends on the outer table down into the right child, materialization of the right child will only return the rows that join with the _first_ row of the outer result set, which is wrong. If, on the other hand, we push the predicate to one side and then tell the caller to remove it from its list, the side to which we did _not_ push the predicate could return rows that aren't qualified. Then, since the caller removed the predicate from its list, it (the caller) will not evaluate the predicate on its own result set--and thus we can end up returning rows that we weren't supposed to return. So all of that said, only push (and return "true") if we think we can push the predicate to both sides.
-
pullOptPredicates
public void pullOptPredicates(OptimizablePredicateList optimizablePredicates) throws StandardException
Description copied from interface:OptimizablePull all the OptimizablePredicates from this Optimizable and put them in the given OptimizablePredicateList.- Specified by:
pullOptPredicatesin interfaceOptimizable- Parameters:
optimizablePredicates- The list to put the pulled predicates in.- Throws:
StandardException- Thrown on error- See Also:
Optimizable.pullOptPredicates(org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
-
toString
public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.- Returns:
- This object as a String
-
bindExpressions
public void bindExpressions(org.apache.derby.impl.sql.compile.FromList fromList) throws StandardExceptionBind the expressions under this TableOperatorNode. This means binding the sub-expressions, as well as figuring out what the return type is for each expression.- Parameters:
fromList- FromList to use/append to.- Throws:
StandardException- Thrown on error
-
pushQueryExpressionSuffix
public void pushQueryExpressionSuffix()
Description copied from class:ResultSetNodeSet up a new level for order by and fetch/offset clauses. See Javadoc forResultSetNode.QueryExpressionClauses. Overridden by implementors of pushOrderByNode, pushOffsetFetchFirst.
-
verifyProperties
public void verifyProperties(DataDictionary dDictionary) throws StandardException
Description copied from interface:OptimizableVerify that the Properties list with optimizer overrides, if specified, is valid- Specified by:
verifyPropertiesin interfaceOptimizable- Parameters:
dDictionary- The DataDictionary to use.- Throws:
StandardException- Thrown on error- See Also:
Optimizable.verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary)
-
updateBestPlanMap
public void updateBestPlanMap(short action, java.lang.Object planKey) throws StandardExceptionDescription copied from interface:OptimizableWhen remembering "truly the best" access path for an Optimizable, we have to keep track of which OptimizerImpl the "truly the best" access is for. In most queries there will only be one OptimizerImpl in question, but in cases where there are nested subqueries, there will be one OptimizerImpl for every level of nesting, and each OptimizerImpl might have its own idea of what this Optimizable's "truly the best path" access path really is. In addition, there could be Optimizables above this Optimizable that might need to override the best path chosen during optimization. So whenever we save a "truly the best" path, we take note of which Optimizer/Optimizable told us to do so. Then as each level of subquery finishes optimization, the corresponding OptimizerImpl/Optimizable can load its preferred access path into this Optimizable's trulyTheBestAccessPath field and pass it up the tree, until eventually the outer-most OptimizerImpl can choose to either use the best path that it received from below (by calling "rememberAsBest()") or else use the path that it found to be "best" for itself. This method is what allows us to keep track of which OptimizerImpl or Optimizable saved which "best plan", and allows us to load the appropriate plans after each round of optimization.- Specified by:
updateBestPlanMapin interfaceOptimizable- Parameters:
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.- Throws:
StandardException- See Also:
Makes a call to add/load/remove the plan mapping for this node, and then makes the necessary call to recurse on this node's left and right child, in order to ensure that we've handled the full plan all the way down this node's subtree.
-
referencesSessionSchema
public boolean referencesSessionSchema() throws StandardExceptionReturn true if the node references SESSION schema tables (temporary or permanent)- Overrides:
referencesSessionSchemain classQueryTreeNode- Returns:
- true if references SESSION schema tables, else false
- Throws:
StandardException- Thrown on error
-
getCorrelationName
public java.lang.String getCorrelationName()
Get this table's correlation name, if any.
-
optimizeIt
public CostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws StandardException
Description copied from interface:OptimizableChoose the best access path for this Optimizable.- Specified by:
optimizeItin interfaceOptimizable- Parameters:
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.- Returns:
- The optimizer's estimated cost of the best access path.
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.optimizeIt(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.CostEstimate, org.apache.derby.iapi.sql.compile.RowOrdering)
-
nextAccessPath
public boolean nextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) throws StandardException
Description copied from interface:OptimizableChoose the next access path to evaluate for this Optimizable.- Specified by:
nextAccessPathin interfaceOptimizable- Parameters:
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.- Returns:
- true means another access path was chosen, false means no more access paths to evaluate.
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.nextAccessPath(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.RowOrdering)
-
getCurrentAccessPath
public AccessPath getCurrentAccessPath()
Description copied from interface:OptimizableGet the current access path under consideration for this Optimizable- Specified by:
getCurrentAccessPathin interfaceOptimizable- See Also:
Optimizable.getCurrentAccessPath()
-
getBestAccessPath
public AccessPath getBestAccessPath()
Description copied from interface:OptimizableGet the best access path for this Optimizable.- Specified by:
getBestAccessPathin interfaceOptimizable- See Also:
Optimizable.getBestAccessPath()
-
getBestSortAvoidancePath
public AccessPath getBestSortAvoidancePath()
Description copied from interface:OptimizableGet the best sort-avoidance path for this Optimizable.- Specified by:
getBestSortAvoidancePathin interfaceOptimizable- See Also:
Optimizable.getBestSortAvoidancePath()
-
getTrulyTheBestAccessPath
public AccessPath getTrulyTheBestAccessPath()
Description copied from interface:OptimizableGet the best access path overall for this Optimizable.- Specified by:
getTrulyTheBestAccessPathin interfaceOptimizable- See Also:
Optimizable.getTrulyTheBestAccessPath()
-
rememberSortAvoidancePath
public void rememberSortAvoidancePath()
Description copied from interface:OptimizableMark this optimizable so that its sort avoidance path will be considered.- Specified by:
rememberSortAvoidancePathin interfaceOptimizable- See Also:
Optimizable.rememberSortAvoidancePath()
-
considerSortAvoidancePath
public boolean considerSortAvoidancePath()
Description copied from interface:OptimizableCheck whether this optimizable's sort avoidance path should be considered.- Specified by:
considerSortAvoidancePathin interfaceOptimizable- See Also:
Optimizable.considerSortAvoidancePath()
-
rememberJoinStrategyAsBest
public void rememberJoinStrategyAsBest(AccessPath ap)
Description copied from interface:OptimizableRemember the current join strategy as the best one so far in this join order.- Specified by:
rememberJoinStrategyAsBestin interfaceOptimizable- See Also:
Optimizable.rememberJoinStrategyAsBest(org.apache.derby.iapi.sql.compile.AccessPath)
-
getTableDescriptor
public TableDescriptor getTableDescriptor()
Description copied from interface:OptimizableGet the table descriptor for this table (if any). Only base tables have table descriptors - for the rest of the optimizables, this method returns null.- Specified by:
getTableDescriptorin interfaceOptimizable- See Also:
Optimizable.getTableDescriptor()
-
isCoveringIndex
public boolean isCoveringIndex(ConglomerateDescriptor cd) throws StandardException
Description copied from interface:OptimizableReturn whether or not this is a covering index. We expect to call this during generation, after access path selection is complete.- Specified by:
isCoveringIndexin interfaceOptimizable- Parameters:
cd- ConglomerateDesriptor for index to consider- Returns:
- boolean Whether or not this is a covering index.
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.isCoveringIndex(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor)
-
getProperties
public java.util.Properties getProperties()
Description copied from interface:OptimizableGet the Properties list, if any, associated with this optimizable.- Specified by:
getPropertiesin interfaceOptimizable- Returns:
- The Properties list, if any, associated with this optimizable.
- See Also:
Optimizable.getProperties()
-
setProperties
public void setProperties(java.util.Properties tableProperties)
Description copied from interface:OptimizableSet the Properties list for this optimizalbe.- Specified by:
setPropertiesin interfaceOptimizable- Parameters:
tableProperties- The Properties list for this optimizable.- See Also:
Optimizable.setProperties(java.util.Properties)
-
getName
public java.lang.String getName() throws StandardExceptionDescription copied from interface:OptimizableGet the (exposed) name of this Optimizable- Specified by:
getNamein interfaceOptimizable- Returns:
- The name of this Optimizable.
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.getName()
-
getBaseTableName
public java.lang.String getBaseTableName()
Description copied from interface:OptimizableGet 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).- Specified by:
getBaseTableNamein interfaceOptimizable- See Also:
Optimizable.getBaseTableName()
-
convertAbsoluteToRelativeColumnPosition
public int convertAbsoluteToRelativeColumnPosition(int absolutePosition)
Description copied from interface:OptimizableConvert an absolute to a relative 0-based column position. This is useful when generating qualifiers for partial rows from the store.- Specified by:
convertAbsoluteToRelativeColumnPositionin interfaceOptimizable- Parameters:
absolutePosition- The absolute 0-based column position for the column.- Returns:
- The relative 0-based column position for the column.
- See Also:
Optimizable.convertAbsoluteToRelativeColumnPosition(int)
-
rememberAsBest
public void rememberAsBest(int planType, Optimizer optimizer) throws StandardExceptionDescription copied from interface:OptimizableRemember the current access path as the best one (so far).- Specified by:
rememberAsBestin interfaceOptimizable- Parameters:
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".- Throws:
StandardException- thrown on error.- See Also:
Optimizable.rememberAsBest(int, org.apache.derby.iapi.sql.compile.Optimizer)
-
startOptimizing
public void startOptimizing(Optimizer optimizer, RowOrdering rowOrdering)
Description copied from interface:OptimizableBegin 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.- Specified by:
startOptimizingin interfaceOptimizable- See Also:
Optimizable.startOptimizing(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.RowOrdering)
-
isBaseTable
public boolean isBaseTable()
Description copied from interface:OptimizableTell whether this Optimizable represents a base table- Specified by:
isBaseTablein interfaceOptimizable- See Also:
Optimizable.isBaseTable()
-
hasLargeObjectColumns
public boolean hasLargeObjectColumns()
Check if any columns containing large objects (BLOBs or CLOBs) are referenced in this table.- Specified by:
hasLargeObjectColumnsin interfaceOptimizable- Returns:
trueif at least one large object column is referenced,falseotherwise
-
isMaterializable
public boolean isMaterializable() throws StandardExceptionDescription copied from interface:OptimizableTell whether this Optimizable is materializable- Specified by:
isMaterializablein interfaceOptimizable- Throws:
StandardException- Thrown on error- See Also:
Optimizable.isMaterializable()
-
supportsMultipleInstantiations
public boolean supportsMultipleInstantiations()
Description copied from interface:OptimizableTell whether this Optimizable can be instantiated multiple times- Specified by:
supportsMultipleInstantiationsin interfaceOptimizable- See Also:
Optimizable.supportsMultipleInstantiations()
-
getTableNumber
public int getTableNumber()
Description copied from interface:OptimizableGet this Optimizable's table number- Specified by:
getTableNumberin interfaceOptimizable- See Also:
Optimizable.getTableNumber()
-
hasTableNumber
public boolean hasTableNumber()
Description copied from interface:OptimizableReturn true if this Optimizable has a table number- Specified by:
hasTableNumberin interfaceOptimizable- See Also:
Optimizable.hasTableNumber()
-
forUpdate
public boolean forUpdate()
Description copied from interface:OptimizableReturn true if this is the target table of an update- Specified by:
forUpdatein interfaceOptimizable- See Also:
Optimizable.forUpdate()
-
initialCapacity
public int initialCapacity()
Description copied from interface:OptimizableReturn the initial capacity of the hash table, for hash join strategy- Specified by:
initialCapacityin interfaceOptimizable- See Also:
Optimizable.initialCapacity()
-
loadFactor
public float loadFactor()
Description copied from interface:OptimizableReturn the load factor of the hash table, for hash join strategy- Specified by:
loadFactorin interfaceOptimizable- See Also:
Optimizable.loadFactor()
-
maxCapacity
public int maxCapacity(JoinStrategy joinStrategy, int maxMemoryPerTable) throws StandardException
Description copied from interface:OptimizableReturn the maximum capacity of the hash table, for hash join strategy- Specified by:
maxCapacityin interfaceOptimizablemaxMemoryPerTable- The maximum number of bytes to be used. Ignored if the user has set a maximum number of rows for the Optimizable.- Throws:
StandardException- Standard error policy- See Also:
Optimizable.maxCapacity(org.apache.derby.iapi.sql.compile.JoinStrategy, int)
-
hashKeyColumns
public int[] hashKeyColumns()
Description copied from interface:OptimizableReturn the hash key column numbers, for hash join strategy- Specified by:
hashKeyColumnsin interfaceOptimizable- See Also:
Optimizable.hashKeyColumns()
-
setHashKeyColumns
public void setHashKeyColumns(int[] columnNumbers)
Description copied from interface:OptimizableSet the hash key column numbers, for hash join strategy- Specified by:
setHashKeyColumnsin interfaceOptimizable- See Also:
Optimizable.setHashKeyColumns(int[])
-
feasibleJoinStrategy
public boolean feasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer) throws StandardException
Description copied from interface:OptimizableIs the current proposed join strategy for this optimizable feasible given the predicate list?- Specified by:
feasibleJoinStrategyin interfaceOptimizable- Parameters:
predList- The predicate list that has been pushed down to this optimizableoptimizer- The optimizer to use.- Returns:
- true means feasible
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.feasibleJoinStrategy(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.Optimizer)
-
memoryUsageOK
public boolean memoryUsageOK(double rowCount, int maxMemoryPerTable) throws StandardException- Specified by:
memoryUsageOKin interfaceOptimizable- Returns:
- true if the memory usage of the proposed access path is OK, false if not.
- Throws:
StandardException- standard error policy- See Also:
Optimizable.memoryUsageOK(double, int)
-
legalJoinOrder
public boolean legalJoinOrder(JBitSet assignedTableMap)
Description copied from interface:OptimizableCan this Optimizable appear at the current location in the join order. In other words, have the Optimizable's dependencies been satisfied?- Specified by:
legalJoinOrderin interfaceOptimizable- Parameters:
assignedTableMap- The tables that have been placed so far in the join order.- Returns:
- Where or not this Optimizable can appear at the current location in the join order.
- See Also:
Optimizable.legalJoinOrder(org.apache.derby.iapi.util.JBitSet)
-
getNumColumnsReturned
public int getNumColumnsReturned()
Description copied from interface:OptimizableGet the number of the number of columns returned by this Optimizable.- Specified by:
getNumColumnsReturnedin interfaceOptimizable- Returns:
- The number of the number of columns returned by this Optimizable.
- See Also:
Optimizable.getNumColumnsReturned()
-
isTargetTable
public boolean isTargetTable()
Description copied from interface:OptimizableIs the optimizable the target table of an update or delete?- Specified by:
isTargetTablein interfaceOptimizable- Returns:
- Whether or not the optimizable the target table of an update or delete.
- See Also:
Optimizable.isTargetTable()
-
isOneRowScan
public boolean isOneRowScan() throws StandardExceptionDescription copied from interface:OptimizableWill the optimizable return at most 1 row per scan?- Specified by:
isOneRowScanin interfaceOptimizable- Returns:
- Whether or not the optimizable will return at most 1 row per scan?
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.isOneRowScan()
-
initAccessPaths
public void initAccessPaths(Optimizer optimizer)
Description copied from interface:OptimizableInit the access paths for this optimizable.- Specified by:
initAccessPathsin interfaceOptimizable- Parameters:
optimizer- The optimizer being used.- See Also:
Optimizable.initAccessPaths(org.apache.derby.iapi.sql.compile.Optimizer)
-
uniqueJoin
public double uniqueJoin(OptimizablePredicateList predList) throws StandardException
Description copied from interface:OptimizableDoes this optimizable have a uniqueness condition on the given predicate list, and if so, how many unique keys will be returned per scan.- Specified by:
uniqueJoinin interfaceOptimizable- Parameters:
predList- The predicate list to check- Returns:
- <= 0 means there is no uniqueness condition > 0 means there is a uniqueness condition, and the return value is the number of rows per scan.
- Throws:
StandardException- Thrown on error- See Also:
Optimizable.uniqueJoin(org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG