Class XMLOptTrace
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.XMLOptTrace
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XMLOptTrace.QueryBlock
-
Field Summary
Fields Modifier and Type Field Description private ContextManager
_cm
private XMLOptTrace.QueryBlock
_currentQueryBlock
private org.w3c.dom.Element
_currentStatement
private int
_currentStatementID
private org.w3c.dom.Document
_doc
private LanguageConnectionContext
_lcc
private int
_maxQueryID
private java.util.Stack<XMLOptTrace.QueryBlock>
_queryBlockStack
private org.w3c.dom.Element
_root
private static java.lang.String
CE_ESTIMATED_COST
private static java.lang.String
CE_ROW_COUNT
private static java.lang.String
CE_SINGLE_SCAN_ROW_COUNT
private static java.lang.String
DECORATION
private static java.lang.String
DECORATION_CONGLOM_COST
private static java.lang.String
DECORATION_CONGLOM_NAME
private static java.lang.String
DECORATION_EXTRA_NON_QUALIFIERS
private static java.lang.String
DECORATION_EXTRA_QUALIFIERS
private static java.lang.String
DECORATION_EXTRA_START_STOP_SELECTIVITY
private static java.lang.String
DECORATION_FIRST_COLUMN_SELECTIVITY
private static java.lang.String
DECORATION_JOIN_STRATEGY
private static java.lang.String
DECORATION_KEY
private static java.lang.String
DECORATION_SKIP
private static java.lang.String
DECORATION_START_STOP_SELECTIVITY
private static java.lang.String
DECORATION_TABLE_NAME
private static java.lang.String
JO
private static java.lang.String
JO_COMPLETE
private static java.lang.String
JO_SLOT
private static java.lang.String
PC
private static java.lang.String
PC_AVOID_SORT
private static java.lang.String
PC_COMPLETE
private static java.lang.String
PC_SUMMARY
private static java.lang.String
PC_TYPE
(package private) static java.lang.String
PLAN_COST_VIEW
(package private) static java.lang.String
PLAN_COST_VTI
private static java.lang.String
QBLOCK
private static java.lang.String
QBLOCK_ID
private static java.lang.String
QBLOCK_NO_BEST_PLAN
private static java.lang.String
QBLOCK_OPT_TABLE_NUMBER
private static java.lang.String
QBLOCK_OPTIMIZABLE
private static java.lang.String
QBLOCK_OPTIMIZER_ID
private static java.lang.String
QBLOCK_SKIP
private static java.lang.String
QBLOCK_SORT_COST
private static java.lang.String
QBLOCK_START_TIME
private static java.lang.String
QBLOCK_TIMEOUT
private static java.lang.String
QBLOCK_TOTAL_COST
private static java.lang.String
QBLOCK_VACUOUS
private static java.lang.String
SEL_COUNT
private static java.lang.String
SEL_SELECTIVITY
private static java.lang.String
SKIP_REASON
private static java.lang.String
STMT
private static java.lang.String
STMT_ID
private static java.lang.String
STMT_TEXT
private static java.lang.String
TABLE_FUNCTION_FLAG
-
Constructor Summary
Constructors Constructor Description XMLOptTrace()
0-arg constructor required by OptTrace contract
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.w3c.dom.Element
createElement(org.w3c.dom.Element parent, java.lang.String tag, java.lang.String content)
Create an element and add it to a parentprivate void
formatCost(org.w3c.dom.Element costElement, CostEstimate raw)
Format a CostEstimate as subelements of a parentprivate void
formatJoinOrder(org.w3c.dom.Element parent, int[] proposedJoinOrder)
Format a join order listprivate org.w3c.dom.Element
formatPlanCost(org.w3c.dom.Element parent, java.lang.String type, int[] planOrder, int planType, CostEstimate raw)
Turn a CostEstimate for a join order into a human-readable elementprivate java.lang.String
formatPlanSummary(int[] planOrder, int planType)
Produce a string representation of the plan being considered now.private void
formatSelectivity(org.w3c.dom.Element parent, java.lang.String tag, int count, double selectivity)
Format selectivity subelementprivate org.w3c.dom.Element
formatSkip(org.w3c.dom.Element parent, java.lang.String skipTag, java.lang.String reason)
Create an element explaining that we're skipping some processingprivate java.lang.String
formatTimestamp(long timestamp)
Turn a timestamp into a human-readable stringprivate Optimizable
getOptimizable(int tableNumber)
Get the Optimizable with the given tableNumberprivate TableName
getOptimizableName(Optimizable optimizable)
Get the name of an optimizableprivate boolean
isBaseTable(Optimizable optimizable)
Return true if the optimizable is a base tableprivate boolean
isComplete(int[] joinOrder)
Return true if the join order has been completely filled inprivate boolean
isFromTable(Optimizable optimizable)
Return true if the optimizable is a FromTableprivate TableName
makeTableName(java.lang.String schemaName, java.lang.String unqualifiedName, ContextManager cm)
Make a TableNameprivate void
printThrowable(java.lang.Throwable t)
Print an exception to the log filevoid
printToWriter(java.io.PrintWriter out)
Print the trace so far.void
traceAddingUnorderedOptimizable(int predicateCount)
Say that we're adding an unordered optimizable.void
traceChangingAccessPathForTable(int tableNumber)
Say that we're considering a different access path for a table.void
traceCheapestPlanSoFar(int planType, CostEstimate currentCost)
Report the cost of the cheapest plan so far.void
traceCompleteJoinOrder()
Say that we have a complete join order.void
traceCompositeSelectivityFromStatistics(double statCompositeSelectivity)
Report the selectivity calculated from SYSSTATISTICS.void
traceConsideringConglomerate(ConglomerateDescriptor cd, int tableNumber)
Report that we are considering a conglomerate for a table.void
traceConsideringJoinStrategy(JoinStrategy js, int tableNumber)
Say that we're considering a particular join strategy on a particular table.void
traceConstantStartStopPositions()
Say that we're setting the lock mode to MODE_RECORD because the start and stop positions are all constant.void
traceCostIncludingCompositeSelectivityFromStats(CostEstimate cost, int tableNumber)
Report the cost based on selectivities coming out of SYSSTATISTICS.void
traceCostIncludingExtra1stColumnSelectivity(CostEstimate cost, int tableNumber)
Report the cost of a scan given the selectivity of an extra first column.void
traceCostIncludingExtraNonQualifierSelectivity(CostEstimate cost, int tableNumber)
Report the cost if we include an extra non-qualifier.void
traceCostIncludingExtraQualifierSelectivity(CostEstimate cost, int tableNumber)
Report the cost if we include an extra qualifier.void
traceCostIncludingExtraStartStop(CostEstimate cost, int tableNumber)
Report the cost if we include an extra start/stop.void
traceCostIncludingStatsForIndex(CostEstimate cost, int tableNumber)
Report the cost based on index statistics.void
traceCostOfConglomerateScan(int tableNumber, ConglomerateDescriptor cd, CostEstimate costEstimate, int numExtraFirstColumnPreds, double extraFirstColumnSelectivity, int numExtraStartStopPreds, double extraStartStopSelectivity, int startStopPredCount, double statStartStopSelectivity, int numExtraQualifiers, double extraQualifierSelectivity, int numExtraNonQualifiers, double extraNonQualifierSelectivity)
Report the cost of a conglomerate scan.void
traceCostOfNoncoveringIndex(CostEstimate cost, int tableNumber)
Report the cost of using a non-covering index.void
traceCostOfNScans(int tableNumber, double rowCount, CostEstimate cost)
Report the cost of scanning a table a certain number of timesvoid
traceCostWithoutSortAvoidance(CostEstimate currentCost)
Report the cost without a sort.void
traceCostWithSortAvoidance(CostEstimate currentSortAvoidanceCost)
Report the cost with sort avoidance.void
traceCurrentPlanAvoidsSort(CostEstimate bestCost, CostEstimate currentSortAvoidanceCost)
Say that the current plan avoids a sort.void
traceEndQueryBlock()
End tracing the optimization of a query block.void
traceEstimatingCostOfConglomerate(ConglomerateDescriptor cd, int tableNumber)
Report the cost of using a particular conglomerate to scan a table.void
traceHashKeyColumns(int[] hashKeyColumns)
Report the columns being tracedvoid
traceIllegalUserJoinOrder()
Say that the user specified an impossible join order.void
traceJoinOrderConsideration(int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)
Say that we're considering a join order.void
traceLookingForSpecifiedIndex(java.lang.String indexName, int tableNumber)
Say that we're looking for an index specified by optimizer hints.void
traceModifyingAccessPaths(int optimizerID)
Say that we're modifying access paths.void
traceNextAccessPath(java.lang.String baseTable, int predicateCount)
Report that we are advancing to the next access path for the table.void
traceNoBestPlan()
Say that we couldn't find a best plan.void
traceNoMoreConglomerates(int tableNumber)
Say that we have exhausted the conglomerate possibilities for a table.void
traceNonCoveringIndexCost(double cost, int tableNumber)
Say that we're considering a non-covering index.void
traceNoStartStopPosition()
Say that we're setting the lock mode to MODE_TABLE because there is no start/stop position.void
traceOptimizingJoinNode()
Say that we're starting to optimize a join nodevoid
traceRememberingBestAccessPath(AccessPath accessPath, int tableNumber, int planType)
Report that we've found a best access path.void
traceRememberingBestAccessPathSubstring(AccessPath ap, int tableNumber)
Report the best access path for the table so far.void
traceRememberingBestJoinOrder(int joinPosition, int[] bestJoinOrder, int planType, CostEstimate planCost, JBitSet assignedTableMap)
Say that we are remembering the current plan as the best join order so far.void
traceRememberingBestSortAvoidanceAccessPathSubstring(AccessPath ap, int tableNumber)
Report the best sort-avoiding access path for this table so far.void
traceRememberingBestUnknownAccessPathSubstring(AccessPath ap, int tableNumber)
Report an optimizer failure, e.g., while optimizing an outer joinvoid
traceRememberingJoinStrategy(JoinStrategy joinStrategy, int tableNumber)
Say that we've found a new best join strategy for the table.void
traceScanningHeapWithUniqueKey()
Say that we're considering scanning a heap even though we have a unique key match.void
traceShortCircuiting(boolean timeExceeded, Optimizable thisOpt, int joinPosition)
Say that we short-circuited a join order.void
traceSingleMatchedRowCost(double cost, int tableNumber)
Report the cost of a scan which will match exactly one row.void
traceSkipHashJoinNoHashKeys()
Say we won't consider a hash join because there are no hash key columns.void
traceSkippingBecauseTooMuchMemory(int maxMemoryPerTable)
Say that we are skipping a plan because it consumes too much memory.void
traceSkippingJoinOrder(int nextOptimizable, int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)
Say that we're skipping the join order starting with the next optimizable.void
traceSkipUnmaterializableHashJoin()
Say that we won't consider a hash join because the result can't be materializedvoid
traceSortCost(CostEstimate sortCost, CostEstimate currentCost)
Report the sort cost.void
traceSortNeededForOrdering(int planType, RequiredRowOrdering requiredRowOrdering)
Report that this plan needs a sortvoid
traceStartQueryBlock(long timeOptimizationStarted, int optimizerID, OptimizableList optimizableList)
Start optimizer tracing for a query block.void
traceStartStatement(java.lang.String statementText)
Start the start of tracing a statement.void
traceTimeout(long currentTime, CostEstimate bestCost)
Say that the optimizer ran out of time.void
traceUserJoinOrderOptimized()
Say that we have optimized the user-specified join order.void
traceVacuous()
Say that there's nothing to optimizer.
-
-
-
Field Detail
-
STMT
private static final java.lang.String STMT
- See Also:
- Constant Field Values
-
STMT_ID
private static final java.lang.String STMT_ID
- See Also:
- Constant Field Values
-
STMT_TEXT
private static final java.lang.String STMT_TEXT
- See Also:
- Constant Field Values
-
QBLOCK
private static final java.lang.String QBLOCK
- See Also:
- Constant Field Values
-
QBLOCK_OPTIMIZER_ID
private static final java.lang.String QBLOCK_OPTIMIZER_ID
- See Also:
- Constant Field Values
-
QBLOCK_START_TIME
private static final java.lang.String QBLOCK_START_TIME
- See Also:
- Constant Field Values
-
QBLOCK_ID
private static final java.lang.String QBLOCK_ID
- See Also:
- Constant Field Values
-
QBLOCK_OPTIMIZABLE
private static final java.lang.String QBLOCK_OPTIMIZABLE
- See Also:
- Constant Field Values
-
QBLOCK_OPT_TABLE_NUMBER
private static final java.lang.String QBLOCK_OPT_TABLE_NUMBER
- See Also:
- Constant Field Values
-
QBLOCK_TIMEOUT
private static final java.lang.String QBLOCK_TIMEOUT
- See Also:
- Constant Field Values
-
QBLOCK_VACUOUS
private static final java.lang.String QBLOCK_VACUOUS
- See Also:
- Constant Field Values
-
QBLOCK_SORT_COST
private static final java.lang.String QBLOCK_SORT_COST
- See Also:
- Constant Field Values
-
QBLOCK_TOTAL_COST
private static final java.lang.String QBLOCK_TOTAL_COST
- See Also:
- Constant Field Values
-
QBLOCK_NO_BEST_PLAN
private static final java.lang.String QBLOCK_NO_BEST_PLAN
- See Also:
- Constant Field Values
-
QBLOCK_SKIP
private static final java.lang.String QBLOCK_SKIP
- See Also:
- Constant Field Values
-
JO
private static final java.lang.String JO
- See Also:
- Constant Field Values
-
JO_COMPLETE
private static final java.lang.String JO_COMPLETE
- See Also:
- Constant Field Values
-
JO_SLOT
private static final java.lang.String JO_SLOT
- See Also:
- Constant Field Values
-
DECORATION
private static final java.lang.String DECORATION
- See Also:
- Constant Field Values
-
DECORATION_CONGLOM_NAME
private static final java.lang.String DECORATION_CONGLOM_NAME
- See Also:
- Constant Field Values
-
DECORATION_KEY
private static final java.lang.String DECORATION_KEY
- See Also:
- Constant Field Values
-
DECORATION_TABLE_NAME
private static final java.lang.String DECORATION_TABLE_NAME
- See Also:
- Constant Field Values
-
DECORATION_JOIN_STRATEGY
private static final java.lang.String DECORATION_JOIN_STRATEGY
- See Also:
- Constant Field Values
-
DECORATION_SKIP
private static final java.lang.String DECORATION_SKIP
- See Also:
- Constant Field Values
-
DECORATION_CONGLOM_COST
private static final java.lang.String DECORATION_CONGLOM_COST
- See Also:
- Constant Field Values
-
DECORATION_FIRST_COLUMN_SELECTIVITY
private static final java.lang.String DECORATION_FIRST_COLUMN_SELECTIVITY
- See Also:
- Constant Field Values
-
DECORATION_EXTRA_START_STOP_SELECTIVITY
private static final java.lang.String DECORATION_EXTRA_START_STOP_SELECTIVITY
- See Also:
- Constant Field Values
-
DECORATION_START_STOP_SELECTIVITY
private static final java.lang.String DECORATION_START_STOP_SELECTIVITY
- See Also:
- Constant Field Values
-
DECORATION_EXTRA_QUALIFIERS
private static final java.lang.String DECORATION_EXTRA_QUALIFIERS
- See Also:
- Constant Field Values
-
DECORATION_EXTRA_NON_QUALIFIERS
private static final java.lang.String DECORATION_EXTRA_NON_QUALIFIERS
- See Also:
- Constant Field Values
-
SKIP_REASON
private static final java.lang.String SKIP_REASON
- See Also:
- Constant Field Values
-
PC
private static final java.lang.String PC
- See Also:
- Constant Field Values
-
PC_TYPE
private static final java.lang.String PC_TYPE
- See Also:
- Constant Field Values
-
PC_COMPLETE
private static final java.lang.String PC_COMPLETE
- See Also:
- Constant Field Values
-
PC_AVOID_SORT
private static final java.lang.String PC_AVOID_SORT
- See Also:
- Constant Field Values
-
PC_SUMMARY
private static final java.lang.String PC_SUMMARY
- See Also:
- Constant Field Values
-
CE_ESTIMATED_COST
private static final java.lang.String CE_ESTIMATED_COST
- See Also:
- Constant Field Values
-
CE_ROW_COUNT
private static final java.lang.String CE_ROW_COUNT
- See Also:
- Constant Field Values
-
CE_SINGLE_SCAN_ROW_COUNT
private static final java.lang.String CE_SINGLE_SCAN_ROW_COUNT
- See Also:
- Constant Field Values
-
SEL_COUNT
private static final java.lang.String SEL_COUNT
- See Also:
- Constant Field Values
-
SEL_SELECTIVITY
private static final java.lang.String SEL_SELECTIVITY
- See Also:
- Constant Field Values
-
TABLE_FUNCTION_FLAG
private static final java.lang.String TABLE_FUNCTION_FLAG
- See Also:
- Constant Field Values
-
PLAN_COST_VTI
static final java.lang.String PLAN_COST_VTI
- See Also:
- Constant Field Values
-
PLAN_COST_VIEW
static final java.lang.String PLAN_COST_VIEW
- See Also:
- Constant Field Values
-
_doc
private org.w3c.dom.Document _doc
-
_root
private org.w3c.dom.Element _root
-
_currentStatement
private org.w3c.dom.Element _currentStatement
-
_currentStatementID
private int _currentStatementID
-
_currentQueryBlock
private XMLOptTrace.QueryBlock _currentQueryBlock
-
_maxQueryID
private int _maxQueryID
-
_queryBlockStack
private java.util.Stack<XMLOptTrace.QueryBlock> _queryBlockStack
-
_cm
private ContextManager _cm
-
_lcc
private LanguageConnectionContext _lcc
-
-
Method Detail
-
traceStartStatement
public void traceStartStatement(java.lang.String statementText)
Description copied from interface:OptTrace
Start the start of tracing a statement.- Specified by:
traceStartStatement
in interfaceOptTrace
-
traceStartQueryBlock
public void traceStartQueryBlock(long timeOptimizationStarted, int optimizerID, OptimizableList optimizableList)
Description copied from interface:OptTrace
Start optimizer tracing for a query block.- Specified by:
traceStartQueryBlock
in interfaceOptTrace
-
traceEndQueryBlock
public void traceEndQueryBlock()
Description copied from interface:OptTrace
End tracing the optimization of a query block.- Specified by:
traceEndQueryBlock
in interfaceOptTrace
-
traceTimeout
public void traceTimeout(long currentTime, CostEstimate bestCost)
Description copied from interface:OptTrace
Say that the optimizer ran out of time.- Specified by:
traceTimeout
in interfaceOptTrace
-
traceVacuous
public void traceVacuous()
Description copied from interface:OptTrace
Say that there's nothing to optimizer.- Specified by:
traceVacuous
in interfaceOptTrace
-
traceCompleteJoinOrder
public void traceCompleteJoinOrder()
Description copied from interface:OptTrace
Say that we have a complete join order.- Specified by:
traceCompleteJoinOrder
in interfaceOptTrace
-
traceSortCost
public void traceSortCost(CostEstimate sortCost, CostEstimate currentCost)
Description copied from interface:OptTrace
Report the sort cost.- Specified by:
traceSortCost
in interfaceOptTrace
-
traceNoBestPlan
public void traceNoBestPlan()
Description copied from interface:OptTrace
Say that we couldn't find a best plan.- Specified by:
traceNoBestPlan
in interfaceOptTrace
-
traceModifyingAccessPaths
public void traceModifyingAccessPaths(int optimizerID)
Description copied from interface:OptTrace
Say that we're modifying access paths.- Specified by:
traceModifyingAccessPaths
in interfaceOptTrace
-
traceShortCircuiting
public void traceShortCircuiting(boolean timeExceeded, Optimizable thisOpt, int joinPosition)
Description copied from interface:OptTrace
Say that we short-circuited a join order.- Specified by:
traceShortCircuiting
in interfaceOptTrace
-
traceSkippingJoinOrder
public void traceSkippingJoinOrder(int nextOptimizable, int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)
Description copied from interface:OptTrace
Say that we're skipping the join order starting with the next optimizable.- Specified by:
traceSkippingJoinOrder
in interfaceOptTrace
-
traceIllegalUserJoinOrder
public void traceIllegalUserJoinOrder()
Description copied from interface:OptTrace
Say that the user specified an impossible join order.- Specified by:
traceIllegalUserJoinOrder
in interfaceOptTrace
-
traceUserJoinOrderOptimized
public void traceUserJoinOrderOptimized()
Description copied from interface:OptTrace
Say that we have optimized the user-specified join order.- Specified by:
traceUserJoinOrderOptimized
in interfaceOptTrace
-
traceJoinOrderConsideration
public void traceJoinOrderConsideration(int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)
Description copied from interface:OptTrace
Say that we're considering a join order.- Specified by:
traceJoinOrderConsideration
in interfaceOptTrace
-
traceCostWithoutSortAvoidance
public void traceCostWithoutSortAvoidance(CostEstimate currentCost)
Description copied from interface:OptTrace
Report the cost without a sort.- Specified by:
traceCostWithoutSortAvoidance
in interfaceOptTrace
-
traceCostWithSortAvoidance
public void traceCostWithSortAvoidance(CostEstimate currentSortAvoidanceCost)
Description copied from interface:OptTrace
Report the cost with sort avoidance.- Specified by:
traceCostWithSortAvoidance
in interfaceOptTrace
-
traceCurrentPlanAvoidsSort
public void traceCurrentPlanAvoidsSort(CostEstimate bestCost, CostEstimate currentSortAvoidanceCost)
Description copied from interface:OptTrace
Say that the current plan avoids a sort.- Specified by:
traceCurrentPlanAvoidsSort
in interfaceOptTrace
-
traceCheapestPlanSoFar
public void traceCheapestPlanSoFar(int planType, CostEstimate currentCost)
Description copied from interface:OptTrace
Report the cost of the cheapest plan so far.- Specified by:
traceCheapestPlanSoFar
in interfaceOptTrace
-
traceSortNeededForOrdering
public void traceSortNeededForOrdering(int planType, RequiredRowOrdering requiredRowOrdering)
Description copied from interface:OptTrace
Report that this plan needs a sort- Specified by:
traceSortNeededForOrdering
in interfaceOptTrace
-
traceRememberingBestJoinOrder
public void traceRememberingBestJoinOrder(int joinPosition, int[] bestJoinOrder, int planType, CostEstimate planCost, JBitSet assignedTableMap)
Description copied from interface:OptTrace
Say that we are remembering the current plan as the best join order so far.- Specified by:
traceRememberingBestJoinOrder
in interfaceOptTrace
-
traceSkippingBecauseTooMuchMemory
public void traceSkippingBecauseTooMuchMemory(int maxMemoryPerTable)
Description copied from interface:OptTrace
Say that we are skipping a plan because it consumes too much memory.- Specified by:
traceSkippingBecauseTooMuchMemory
in interfaceOptTrace
-
traceCostOfNScans
public void traceCostOfNScans(int tableNumber, double rowCount, CostEstimate cost)
Description copied from interface:OptTrace
Report the cost of scanning a table a certain number of times- Specified by:
traceCostOfNScans
in interfaceOptTrace
-
traceSkipUnmaterializableHashJoin
public void traceSkipUnmaterializableHashJoin()
Description copied from interface:OptTrace
Say that we won't consider a hash join because the result can't be materialized- Specified by:
traceSkipUnmaterializableHashJoin
in interfaceOptTrace
-
traceSkipHashJoinNoHashKeys
public void traceSkipHashJoinNoHashKeys()
Description copied from interface:OptTrace
Say we won't consider a hash join because there are no hash key columns.- Specified by:
traceSkipHashJoinNoHashKeys
in interfaceOptTrace
-
traceHashKeyColumns
public void traceHashKeyColumns(int[] hashKeyColumns)
Description copied from interface:OptTrace
Report the columns being traced- Specified by:
traceHashKeyColumns
in interfaceOptTrace
-
traceOptimizingJoinNode
public void traceOptimizingJoinNode()
Description copied from interface:OptTrace
Say that we're starting to optimize a join node- Specified by:
traceOptimizingJoinNode
in interfaceOptTrace
-
traceConsideringJoinStrategy
public void traceConsideringJoinStrategy(JoinStrategy js, int tableNumber)
Description copied from interface:OptTrace
Say that we're considering a particular join strategy on a particular table.- Specified by:
traceConsideringJoinStrategy
in interfaceOptTrace
-
traceRememberingBestAccessPath
public void traceRememberingBestAccessPath(AccessPath accessPath, int tableNumber, int planType)
Description copied from interface:OptTrace
Report that we've found a best access path.- Specified by:
traceRememberingBestAccessPath
in interfaceOptTrace
-
traceNoMoreConglomerates
public void traceNoMoreConglomerates(int tableNumber)
Description copied from interface:OptTrace
Say that we have exhausted the conglomerate possibilities for a table.- Specified by:
traceNoMoreConglomerates
in interfaceOptTrace
-
traceConsideringConglomerate
public void traceConsideringConglomerate(ConglomerateDescriptor cd, int tableNumber)
Description copied from interface:OptTrace
Report that we are considering a conglomerate for a table.- Specified by:
traceConsideringConglomerate
in interfaceOptTrace
-
traceScanningHeapWithUniqueKey
public void traceScanningHeapWithUniqueKey()
Description copied from interface:OptTrace
Say that we're considering scanning a heap even though we have a unique key match.- Specified by:
traceScanningHeapWithUniqueKey
in interfaceOptTrace
-
traceAddingUnorderedOptimizable
public void traceAddingUnorderedOptimizable(int predicateCount)
Description copied from interface:OptTrace
Say that we're adding an unordered optimizable.- Specified by:
traceAddingUnorderedOptimizable
in interfaceOptTrace
-
traceChangingAccessPathForTable
public void traceChangingAccessPathForTable(int tableNumber)
Description copied from interface:OptTrace
Say that we're considering a different access path for a table.- Specified by:
traceChangingAccessPathForTable
in interfaceOptTrace
-
traceNoStartStopPosition
public void traceNoStartStopPosition()
Description copied from interface:OptTrace
Say that we're setting the lock mode to MODE_TABLE because there is no start/stop position.- Specified by:
traceNoStartStopPosition
in interfaceOptTrace
-
traceNonCoveringIndexCost
public void traceNonCoveringIndexCost(double cost, int tableNumber)
Description copied from interface:OptTrace
Say that we're considering a non-covering index.- Specified by:
traceNonCoveringIndexCost
in interfaceOptTrace
-
traceConstantStartStopPositions
public void traceConstantStartStopPositions()
Description copied from interface:OptTrace
Say that we're setting the lock mode to MODE_RECORD because the start and stop positions are all constant.- Specified by:
traceConstantStartStopPositions
in interfaceOptTrace
-
traceEstimatingCostOfConglomerate
public void traceEstimatingCostOfConglomerate(ConglomerateDescriptor cd, int tableNumber)
Description copied from interface:OptTrace
Report the cost of using a particular conglomerate to scan a table.- Specified by:
traceEstimatingCostOfConglomerate
in interfaceOptTrace
-
traceLookingForSpecifiedIndex
public void traceLookingForSpecifiedIndex(java.lang.String indexName, int tableNumber)
Description copied from interface:OptTrace
Say that we're looking for an index specified by optimizer hints.- Specified by:
traceLookingForSpecifiedIndex
in interfaceOptTrace
-
traceSingleMatchedRowCost
public void traceSingleMatchedRowCost(double cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost of a scan which will match exactly one row.- Specified by:
traceSingleMatchedRowCost
in interfaceOptTrace
-
traceCostIncludingExtra1stColumnSelectivity
public void traceCostIncludingExtra1stColumnSelectivity(CostEstimate cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost of a scan given the selectivity of an extra first column.- Specified by:
traceCostIncludingExtra1stColumnSelectivity
in interfaceOptTrace
-
traceNextAccessPath
public void traceNextAccessPath(java.lang.String baseTable, int predicateCount)
Description copied from interface:OptTrace
Report that we are advancing to the next access path for the table.- Specified by:
traceNextAccessPath
in interfaceOptTrace
-
traceCostIncludingExtraStartStop
public void traceCostIncludingExtraStartStop(CostEstimate cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost if we include an extra start/stop.- Specified by:
traceCostIncludingExtraStartStop
in interfaceOptTrace
-
traceCostIncludingExtraQualifierSelectivity
public void traceCostIncludingExtraQualifierSelectivity(CostEstimate cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost if we include an extra qualifier.- Specified by:
traceCostIncludingExtraQualifierSelectivity
in interfaceOptTrace
-
traceCostIncludingExtraNonQualifierSelectivity
public void traceCostIncludingExtraNonQualifierSelectivity(CostEstimate cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost if we include an extra non-qualifier.- Specified by:
traceCostIncludingExtraNonQualifierSelectivity
in interfaceOptTrace
-
traceCostOfNoncoveringIndex
public void traceCostOfNoncoveringIndex(CostEstimate cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost of using a non-covering index.- Specified by:
traceCostOfNoncoveringIndex
in interfaceOptTrace
-
traceRememberingJoinStrategy
public void traceRememberingJoinStrategy(JoinStrategy joinStrategy, int tableNumber)
Description copied from interface:OptTrace
Say that we've found a new best join strategy for the table.- Specified by:
traceRememberingJoinStrategy
in interfaceOptTrace
-
traceRememberingBestAccessPathSubstring
public void traceRememberingBestAccessPathSubstring(AccessPath ap, int tableNumber)
Description copied from interface:OptTrace
Report the best access path for the table so far.- Specified by:
traceRememberingBestAccessPathSubstring
in interfaceOptTrace
-
traceRememberingBestSortAvoidanceAccessPathSubstring
public void traceRememberingBestSortAvoidanceAccessPathSubstring(AccessPath ap, int tableNumber)
Description copied from interface:OptTrace
Report the best sort-avoiding access path for this table so far.- Specified by:
traceRememberingBestSortAvoidanceAccessPathSubstring
in interfaceOptTrace
-
traceRememberingBestUnknownAccessPathSubstring
public void traceRememberingBestUnknownAccessPathSubstring(AccessPath ap, int tableNumber)
Description copied from interface:OptTrace
Report an optimizer failure, e.g., while optimizing an outer join- Specified by:
traceRememberingBestUnknownAccessPathSubstring
in interfaceOptTrace
-
traceCostOfConglomerateScan
public void traceCostOfConglomerateScan(int tableNumber, ConglomerateDescriptor cd, CostEstimate costEstimate, int numExtraFirstColumnPreds, double extraFirstColumnSelectivity, int numExtraStartStopPreds, double extraStartStopSelectivity, int startStopPredCount, double statStartStopSelectivity, int numExtraQualifiers, double extraQualifierSelectivity, int numExtraNonQualifiers, double extraNonQualifierSelectivity)
Description copied from interface:OptTrace
Report the cost of a conglomerate scan.- Specified by:
traceCostOfConglomerateScan
in interfaceOptTrace
-
traceCostIncludingCompositeSelectivityFromStats
public void traceCostIncludingCompositeSelectivityFromStats(CostEstimate cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost based on selectivities coming out of SYSSTATISTICS.- Specified by:
traceCostIncludingCompositeSelectivityFromStats
in interfaceOptTrace
-
traceCompositeSelectivityFromStatistics
public void traceCompositeSelectivityFromStatistics(double statCompositeSelectivity)
Description copied from interface:OptTrace
Report the selectivity calculated from SYSSTATISTICS.- Specified by:
traceCompositeSelectivityFromStatistics
in interfaceOptTrace
-
traceCostIncludingStatsForIndex
public void traceCostIncludingStatsForIndex(CostEstimate cost, int tableNumber)
Description copied from interface:OptTrace
Report the cost based on index statistics.- Specified by:
traceCostIncludingStatsForIndex
in interfaceOptTrace
-
printToWriter
public void printToWriter(java.io.PrintWriter out)
Description copied from interface:OptTrace
Print the trace so far.- Specified by:
printToWriter
in interfaceOptTrace
-
getOptimizable
private Optimizable getOptimizable(int tableNumber)
Get the Optimizable with the given tableNumber
-
getOptimizableName
private TableName getOptimizableName(Optimizable optimizable)
Get the name of an optimizable
-
isBaseTable
private boolean isBaseTable(Optimizable optimizable)
Return true if the optimizable is a base table
-
isFromTable
private boolean isFromTable(Optimizable optimizable)
Return true if the optimizable is a FromTable
-
makeTableName
private TableName makeTableName(java.lang.String schemaName, java.lang.String unqualifiedName, ContextManager cm)
Make a TableName
-
printThrowable
private void printThrowable(java.lang.Throwable t)
Print an exception to the log file
-
createElement
private org.w3c.dom.Element createElement(org.w3c.dom.Element parent, java.lang.String tag, java.lang.String content)
Create an element and add it to a parent
-
formatTimestamp
private java.lang.String formatTimestamp(long timestamp)
Turn a timestamp into a human-readable string
-
formatSkip
private org.w3c.dom.Element formatSkip(org.w3c.dom.Element parent, java.lang.String skipTag, java.lang.String reason)
Create an element explaining that we're skipping some processing
-
formatPlanCost
private org.w3c.dom.Element formatPlanCost(org.w3c.dom.Element parent, java.lang.String type, int[] planOrder, int planType, CostEstimate raw)
Turn a CostEstimate for a join order into a human-readable element
-
isComplete
private boolean isComplete(int[] joinOrder)
Return true if the join order has been completely filled in
-
formatCost
private void formatCost(org.w3c.dom.Element costElement, CostEstimate raw)
Format a CostEstimate as subelements of a parent
-
formatSelectivity
private void formatSelectivity(org.w3c.dom.Element parent, java.lang.String tag, int count, double selectivity)
Format selectivity subelement
-
formatJoinOrder
private void formatJoinOrder(org.w3c.dom.Element parent, int[] proposedJoinOrder)
Format a join order list
-
formatPlanSummary
private java.lang.String formatPlanSummary(int[] planOrder, int planType)
Produce a string representation of the plan being considered now. The string has the following grammar:
join :== factor OP factor OP :== "*" | "#" factor :== factor | conglomerateName
-
-