Class DefaultOptTrace
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.DefaultOptTrace
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringBuilder_buffer
-
Constructor Summary
Constructors Constructor Description DefaultOptTrace()Make a DefaultOptTrace
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappendTraceString(java.lang.String traceString)Append a string to the optimizer tracevoidprintToWriter(java.io.PrintWriter out)Print the trace so far.private java.lang.StringreportConglomerateDescriptor(ConglomerateDescriptor cd)private java.lang.StringreportCostForTable(java.lang.Object cost, int tableNumber)private java.lang.StringreportCostIncluding(java.lang.String selectivityType, CostEstimate cost, int tableNumber)private java.lang.StringreportJoinOrder(java.lang.String prefix, boolean addJoinOrderNumber, int joinOrderNumber, int joinPosition, int[] joinOrder, JBitSet assignedTableMap)voidtraceAddingUnorderedOptimizable(int predicateCount)Say that we're adding an unordered optimizable.voidtraceChangingAccessPathForTable(int tableNumber)Say that we're considering a different access path for a table.voidtraceCheapestPlanSoFar(int planType, CostEstimate currentCost)Report the cost of the cheapest plan so far.voidtraceCompleteJoinOrder()Say that we have a complete join order.voidtraceCompositeSelectivityFromStatistics(double statCompositeSelectivity)Report the selectivity calculated from SYSSTATISTICS.voidtraceConsideringConglomerate(ConglomerateDescriptor cd, int tableNumber)Report that we are considering a conglomerate for a table.voidtraceConsideringJoinStrategy(JoinStrategy js, int tableNumber)Say that we're considering a particular join strategy on a particular table.voidtraceConstantStartStopPositions()Say that we're setting the lock mode to MODE_RECORD because the start and stop positions are all constant.voidtraceCostIncludingCompositeSelectivityFromStats(CostEstimate cost, int tableNumber)Report the cost based on selectivities coming out of SYSSTATISTICS.voidtraceCostIncludingExtra1stColumnSelectivity(CostEstimate cost, int tableNumber)Report the cost of a scan given the selectivity of an extra first column.voidtraceCostIncludingExtraNonQualifierSelectivity(CostEstimate cost, int tableNumber)Report the cost if we include an extra non-qualifier.voidtraceCostIncludingExtraQualifierSelectivity(CostEstimate cost, int tableNumber)Report the cost if we include an extra qualifier.voidtraceCostIncludingExtraStartStop(CostEstimate cost, int tableNumber)Report the cost if we include an extra start/stop.voidtraceCostIncludingStatsForIndex(CostEstimate cost, int tableNumber)Report the cost based on index statistics.voidtraceCostOfConglomerateScan(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.voidtraceCostOfNoncoveringIndex(CostEstimate cost, int tableNumber)Report the cost of using a non-covering index.voidtraceCostOfNScans(int tableNumber, double rowCount, CostEstimate cost)Report the cost of scanning a table a certain number of timesvoidtraceCostWithoutSortAvoidance(CostEstimate currentCost)Report the cost without a sort.voidtraceCostWithSortAvoidance(CostEstimate currentSortAvoidanceCost)Report the cost with sort avoidance.voidtraceCurrentPlanAvoidsSort(CostEstimate bestCost, CostEstimate currentSortAvoidanceCost)Say that the current plan avoids a sort.voidtraceEndQueryBlock()End tracing the optimization of a query block.voidtraceEstimatingCostOfConglomerate(ConglomerateDescriptor cd, int tableNumber)Report the cost of using a particular conglomerate to scan a table.voidtraceHashKeyColumns(int[] hashKeyColumns)Report the columns being tracedvoidtraceIllegalUserJoinOrder()Say that the user specified an impossible join order.voidtraceJoinOrderConsideration(int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)Say that we're considering a join order.voidtraceLookingForSpecifiedIndex(java.lang.String indexName, int tableNumber)Say that we're looking for an index specified by optimizer hints.voidtraceModifyingAccessPaths(int optimizerID)Say that we're modifying access paths.voidtraceNextAccessPath(java.lang.String baseTable, int predicateCount)Report that we are advancing to the next access path for the table.voidtraceNoBestPlan()Say that we couldn't find a best plan.voidtraceNoMoreConglomerates(int tableNumber)Say that we have exhausted the conglomerate possibilities for a table.voidtraceNonCoveringIndexCost(double cost, int tableNumber)Say that we're considering a non-covering index.voidtraceNoStartStopPosition()Say that we're setting the lock mode to MODE_TABLE because there is no start/stop position.voidtraceOptimizingJoinNode()Say that we're starting to optimize a join nodevoidtraceRememberingBestAccessPath(AccessPath accessPath, int tableNumber, int planType)Report that we've found a best access path.voidtraceRememberingBestAccessPathSubstring(AccessPath ap, int tableNumber)Report the best access path for the table so far.voidtraceRememberingBestJoinOrder(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.voidtraceRememberingBestSortAvoidanceAccessPathSubstring(AccessPath ap, int tableNumber)Report the best sort-avoiding access path for this table so far.voidtraceRememberingBestUnknownAccessPathSubstring(AccessPath ap, int tableNumber)Report an optimizer failure, e.g., while optimizing an outer joinvoidtraceRememberingJoinStrategy(JoinStrategy joinStrategy, int tableNumber)Say that we've found a new best join strategy for the table.voidtraceScanningHeapWithUniqueKey()Say that we're considering scanning a heap even though we have a unique key match.voidtraceShortCircuiting(boolean timeExceeded, Optimizable thisOpt, int joinPosition)Say that we short-circuited a join order.voidtraceSingleMatchedRowCost(double cost, int tableNumber)Report the cost of a scan which will match exactly one row.voidtraceSkipHashJoinNoHashKeys()Say we won't consider a hash join because there are no hash key columns.voidtraceSkippingBecauseTooMuchMemory(int maxMemoryPerTable)Say that we are skipping a plan because it consumes too much memory.voidtraceSkippingJoinOrder(int nextOptimizable, int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)Say that we're skipping the join order starting with the next optimizable.voidtraceSkipUnmaterializableHashJoin()Say that we won't consider a hash join because the result can't be materializedvoidtraceSortCost(CostEstimate sortCost, CostEstimate currentCost)Report the sort cost.voidtraceSortNeededForOrdering(int planType, RequiredRowOrdering requiredRowOrdering)Report that this plan needs a sortvoidtraceStartQueryBlock(long timeOptimizationStarted, int optimizerID, OptimizableList optimizableList)Start optimizer tracing for a query block.voidtraceStartStatement(java.lang.String statementText)Start the start of tracing a statement.voidtraceTimeout(long currentTime, CostEstimate bestCost)Say that the optimizer ran out of time.voidtraceUserJoinOrderOptimized()Say that we have optimized the user-specified join order.voidtraceVacuous()Say that there's nothing to optimizer.
-
-
-
Method Detail
-
traceStartStatement
public void traceStartStatement(java.lang.String statementText)
Description copied from interface:OptTraceStart the start of tracing a statement.- Specified by:
traceStartStatementin interfaceOptTrace
-
traceStartQueryBlock
public void traceStartQueryBlock(long timeOptimizationStarted, int optimizerID, OptimizableList optimizableList)Description copied from interface:OptTraceStart optimizer tracing for a query block.- Specified by:
traceStartQueryBlockin interfaceOptTrace
-
traceEndQueryBlock
public void traceEndQueryBlock()
Description copied from interface:OptTraceEnd tracing the optimization of a query block.- Specified by:
traceEndQueryBlockin interfaceOptTrace
-
traceTimeout
public void traceTimeout(long currentTime, CostEstimate bestCost)Description copied from interface:OptTraceSay that the optimizer ran out of time.- Specified by:
traceTimeoutin interfaceOptTrace
-
traceVacuous
public void traceVacuous()
Description copied from interface:OptTraceSay that there's nothing to optimizer.- Specified by:
traceVacuousin interfaceOptTrace
-
traceCompleteJoinOrder
public void traceCompleteJoinOrder()
Description copied from interface:OptTraceSay that we have a complete join order.- Specified by:
traceCompleteJoinOrderin interfaceOptTrace
-
traceSortCost
public void traceSortCost(CostEstimate sortCost, CostEstimate currentCost)
Description copied from interface:OptTraceReport the sort cost.- Specified by:
traceSortCostin interfaceOptTrace
-
traceNoBestPlan
public void traceNoBestPlan()
Description copied from interface:OptTraceSay that we couldn't find a best plan.- Specified by:
traceNoBestPlanin interfaceOptTrace
-
traceModifyingAccessPaths
public void traceModifyingAccessPaths(int optimizerID)
Description copied from interface:OptTraceSay that we're modifying access paths.- Specified by:
traceModifyingAccessPathsin interfaceOptTrace
-
traceShortCircuiting
public void traceShortCircuiting(boolean timeExceeded, Optimizable thisOpt, int joinPosition)Description copied from interface:OptTraceSay that we short-circuited a join order.- Specified by:
traceShortCircuitingin interfaceOptTrace
-
traceSkippingJoinOrder
public void traceSkippingJoinOrder(int nextOptimizable, int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)Description copied from interface:OptTraceSay that we're skipping the join order starting with the next optimizable.- Specified by:
traceSkippingJoinOrderin interfaceOptTrace
-
traceIllegalUserJoinOrder
public void traceIllegalUserJoinOrder()
Description copied from interface:OptTraceSay that the user specified an impossible join order.- Specified by:
traceIllegalUserJoinOrderin interfaceOptTrace
-
traceUserJoinOrderOptimized
public void traceUserJoinOrderOptimized()
Description copied from interface:OptTraceSay that we have optimized the user-specified join order.- Specified by:
traceUserJoinOrderOptimizedin interfaceOptTrace
-
traceJoinOrderConsideration
public void traceJoinOrderConsideration(int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)Description copied from interface:OptTraceSay that we're considering a join order.- Specified by:
traceJoinOrderConsiderationin interfaceOptTrace
-
traceCostWithoutSortAvoidance
public void traceCostWithoutSortAvoidance(CostEstimate currentCost)
Description copied from interface:OptTraceReport the cost without a sort.- Specified by:
traceCostWithoutSortAvoidancein interfaceOptTrace
-
traceCostWithSortAvoidance
public void traceCostWithSortAvoidance(CostEstimate currentSortAvoidanceCost)
Description copied from interface:OptTraceReport the cost with sort avoidance.- Specified by:
traceCostWithSortAvoidancein interfaceOptTrace
-
traceCurrentPlanAvoidsSort
public void traceCurrentPlanAvoidsSort(CostEstimate bestCost, CostEstimate currentSortAvoidanceCost)
Description copied from interface:OptTraceSay that the current plan avoids a sort.- Specified by:
traceCurrentPlanAvoidsSortin interfaceOptTrace
-
traceCheapestPlanSoFar
public void traceCheapestPlanSoFar(int planType, CostEstimate currentCost)Description copied from interface:OptTraceReport the cost of the cheapest plan so far.- Specified by:
traceCheapestPlanSoFarin interfaceOptTrace
-
traceSortNeededForOrdering
public void traceSortNeededForOrdering(int planType, RequiredRowOrdering requiredRowOrdering)Description copied from interface:OptTraceReport that this plan needs a sort- Specified by:
traceSortNeededForOrderingin interfaceOptTrace
-
traceRememberingBestJoinOrder
public void traceRememberingBestJoinOrder(int joinPosition, int[] bestJoinOrder, int planType, CostEstimate planCost, JBitSet assignedTableMap)Description copied from interface:OptTraceSay that we are remembering the current plan as the best join order so far.- Specified by:
traceRememberingBestJoinOrderin interfaceOptTrace
-
traceSkippingBecauseTooMuchMemory
public void traceSkippingBecauseTooMuchMemory(int maxMemoryPerTable)
Description copied from interface:OptTraceSay that we are skipping a plan because it consumes too much memory.- Specified by:
traceSkippingBecauseTooMuchMemoryin interfaceOptTrace
-
traceCostOfNScans
public void traceCostOfNScans(int tableNumber, double rowCount, CostEstimate cost)Description copied from interface:OptTraceReport the cost of scanning a table a certain number of times- Specified by:
traceCostOfNScansin interfaceOptTrace
-
traceSkipUnmaterializableHashJoin
public void traceSkipUnmaterializableHashJoin()
Description copied from interface:OptTraceSay that we won't consider a hash join because the result can't be materialized- Specified by:
traceSkipUnmaterializableHashJoinin interfaceOptTrace
-
traceSkipHashJoinNoHashKeys
public void traceSkipHashJoinNoHashKeys()
Description copied from interface:OptTraceSay we won't consider a hash join because there are no hash key columns.- Specified by:
traceSkipHashJoinNoHashKeysin interfaceOptTrace
-
traceHashKeyColumns
public void traceHashKeyColumns(int[] hashKeyColumns)
Description copied from interface:OptTraceReport the columns being traced- Specified by:
traceHashKeyColumnsin interfaceOptTrace
-
traceOptimizingJoinNode
public void traceOptimizingJoinNode()
Description copied from interface:OptTraceSay that we're starting to optimize a join node- Specified by:
traceOptimizingJoinNodein interfaceOptTrace
-
traceConsideringJoinStrategy
public void traceConsideringJoinStrategy(JoinStrategy js, int tableNumber)
Description copied from interface:OptTraceSay that we're considering a particular join strategy on a particular table.- Specified by:
traceConsideringJoinStrategyin interfaceOptTrace
-
traceRememberingBestAccessPath
public void traceRememberingBestAccessPath(AccessPath accessPath, int tableNumber, int planType)
Description copied from interface:OptTraceReport that we've found a best access path.- Specified by:
traceRememberingBestAccessPathin interfaceOptTrace
-
traceNoMoreConglomerates
public void traceNoMoreConglomerates(int tableNumber)
Description copied from interface:OptTraceSay that we have exhausted the conglomerate possibilities for a table.- Specified by:
traceNoMoreConglomeratesin interfaceOptTrace
-
traceConsideringConglomerate
public void traceConsideringConglomerate(ConglomerateDescriptor cd, int tableNumber)
Description copied from interface:OptTraceReport that we are considering a conglomerate for a table.- Specified by:
traceConsideringConglomeratein interfaceOptTrace
-
traceScanningHeapWithUniqueKey
public void traceScanningHeapWithUniqueKey()
Description copied from interface:OptTraceSay that we're considering scanning a heap even though we have a unique key match.- Specified by:
traceScanningHeapWithUniqueKeyin interfaceOptTrace
-
traceAddingUnorderedOptimizable
public void traceAddingUnorderedOptimizable(int predicateCount)
Description copied from interface:OptTraceSay that we're adding an unordered optimizable.- Specified by:
traceAddingUnorderedOptimizablein interfaceOptTrace
-
traceChangingAccessPathForTable
public void traceChangingAccessPathForTable(int tableNumber)
Description copied from interface:OptTraceSay that we're considering a different access path for a table.- Specified by:
traceChangingAccessPathForTablein interfaceOptTrace
-
traceNoStartStopPosition
public void traceNoStartStopPosition()
Description copied from interface:OptTraceSay that we're setting the lock mode to MODE_TABLE because there is no start/stop position.- Specified by:
traceNoStartStopPositionin interfaceOptTrace
-
traceNonCoveringIndexCost
public void traceNonCoveringIndexCost(double cost, int tableNumber)Description copied from interface:OptTraceSay that we're considering a non-covering index.- Specified by:
traceNonCoveringIndexCostin interfaceOptTrace
-
traceConstantStartStopPositions
public void traceConstantStartStopPositions()
Description copied from interface:OptTraceSay that we're setting the lock mode to MODE_RECORD because the start and stop positions are all constant.- Specified by:
traceConstantStartStopPositionsin interfaceOptTrace
-
traceEstimatingCostOfConglomerate
public void traceEstimatingCostOfConglomerate(ConglomerateDescriptor cd, int tableNumber)
Description copied from interface:OptTraceReport the cost of using a particular conglomerate to scan a table.- Specified by:
traceEstimatingCostOfConglomeratein interfaceOptTrace
-
traceLookingForSpecifiedIndex
public void traceLookingForSpecifiedIndex(java.lang.String indexName, int tableNumber)Description copied from interface:OptTraceSay that we're looking for an index specified by optimizer hints.- Specified by:
traceLookingForSpecifiedIndexin interfaceOptTrace
-
traceSingleMatchedRowCost
public void traceSingleMatchedRowCost(double cost, int tableNumber)Description copied from interface:OptTraceReport the cost of a scan which will match exactly one row.- Specified by:
traceSingleMatchedRowCostin interfaceOptTrace
-
traceCostIncludingExtra1stColumnSelectivity
public void traceCostIncludingExtra1stColumnSelectivity(CostEstimate cost, int tableNumber)
Description copied from interface:OptTraceReport the cost of a scan given the selectivity of an extra first column.- Specified by:
traceCostIncludingExtra1stColumnSelectivityin interfaceOptTrace
-
traceNextAccessPath
public void traceNextAccessPath(java.lang.String baseTable, int predicateCount)Description copied from interface:OptTraceReport that we are advancing to the next access path for the table.- Specified by:
traceNextAccessPathin interfaceOptTrace
-
traceCostIncludingExtraStartStop
public void traceCostIncludingExtraStartStop(CostEstimate cost, int tableNumber)
Description copied from interface:OptTraceReport the cost if we include an extra start/stop.- Specified by:
traceCostIncludingExtraStartStopin interfaceOptTrace
-
traceCostIncludingExtraQualifierSelectivity
public void traceCostIncludingExtraQualifierSelectivity(CostEstimate cost, int tableNumber)
Description copied from interface:OptTraceReport the cost if we include an extra qualifier.- Specified by:
traceCostIncludingExtraQualifierSelectivityin interfaceOptTrace
-
traceCostIncludingExtraNonQualifierSelectivity
public void traceCostIncludingExtraNonQualifierSelectivity(CostEstimate cost, int tableNumber)
Description copied from interface:OptTraceReport the cost if we include an extra non-qualifier.- Specified by:
traceCostIncludingExtraNonQualifierSelectivityin interfaceOptTrace
-
traceCostOfNoncoveringIndex
public void traceCostOfNoncoveringIndex(CostEstimate cost, int tableNumber)
Description copied from interface:OptTraceReport the cost of using a non-covering index.- Specified by:
traceCostOfNoncoveringIndexin interfaceOptTrace
-
traceRememberingJoinStrategy
public void traceRememberingJoinStrategy(JoinStrategy joinStrategy, int tableNumber)
Description copied from interface:OptTraceSay that we've found a new best join strategy for the table.- Specified by:
traceRememberingJoinStrategyin interfaceOptTrace
-
traceRememberingBestAccessPathSubstring
public void traceRememberingBestAccessPathSubstring(AccessPath ap, int tableNumber)
Description copied from interface:OptTraceReport the best access path for the table so far.- Specified by:
traceRememberingBestAccessPathSubstringin interfaceOptTrace
-
traceRememberingBestSortAvoidanceAccessPathSubstring
public void traceRememberingBestSortAvoidanceAccessPathSubstring(AccessPath ap, int tableNumber)
Description copied from interface:OptTraceReport the best sort-avoiding access path for this table so far.- Specified by:
traceRememberingBestSortAvoidanceAccessPathSubstringin interfaceOptTrace
-
traceRememberingBestUnknownAccessPathSubstring
public void traceRememberingBestUnknownAccessPathSubstring(AccessPath ap, int tableNumber)
Description copied from interface:OptTraceReport an optimizer failure, e.g., while optimizing an outer join- Specified by:
traceRememberingBestUnknownAccessPathSubstringin 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:OptTraceReport the cost of a conglomerate scan.- Specified by:
traceCostOfConglomerateScanin interfaceOptTrace
-
traceCostIncludingCompositeSelectivityFromStats
public void traceCostIncludingCompositeSelectivityFromStats(CostEstimate cost, int tableNumber)
Description copied from interface:OptTraceReport the cost based on selectivities coming out of SYSSTATISTICS.- Specified by:
traceCostIncludingCompositeSelectivityFromStatsin interfaceOptTrace
-
traceCompositeSelectivityFromStatistics
public void traceCompositeSelectivityFromStatistics(double statCompositeSelectivity)
Description copied from interface:OptTraceReport the selectivity calculated from SYSSTATISTICS.- Specified by:
traceCompositeSelectivityFromStatisticsin interfaceOptTrace
-
traceCostIncludingStatsForIndex
public void traceCostIncludingStatsForIndex(CostEstimate cost, int tableNumber)
Description copied from interface:OptTraceReport the cost based on index statistics.- Specified by:
traceCostIncludingStatsForIndexin interfaceOptTrace
-
printToWriter
public void printToWriter(java.io.PrintWriter out)
Description copied from interface:OptTracePrint the trace so far.- Specified by:
printToWriterin interfaceOptTrace
-
reportJoinOrder
private java.lang.String reportJoinOrder(java.lang.String prefix, boolean addJoinOrderNumber, int joinOrderNumber, int joinPosition, int[] joinOrder, JBitSet assignedTableMap)
-
reportConglomerateDescriptor
private java.lang.String reportConglomerateDescriptor(ConglomerateDescriptor cd)
-
reportCostForTable
private java.lang.String reportCostForTable(java.lang.Object cost, int tableNumber)
-
reportCostIncluding
private java.lang.String reportCostIncluding(java.lang.String selectivityType, CostEstimate cost, int tableNumber)
-
appendTraceString
private void appendTraceString(java.lang.String traceString)
Append a string to the optimizer trace
-
-