Top Description Inners Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv Class XMLOptTrace

extends Object
implements OptTrace
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.compile.OptTrace
Imports
java.io.PrintWriter, java.util.Date, .Stack, javax.xml.parsers.DocumentBuilderFactory, .ParserConfigurationException, javax.xml.transform.OutputKeys, .Transformer, .TransformerFactory, javax.xml.transform.dom.DOMSource, javax.xml.transform.stream.StreamResult, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.iapi.sql.compile.AccessPath, .CostEstimate, .JoinStrategy, .OptTrace, .Optimizable, .OptimizableList, .Optimizer, .OptimizerPlan, .RequiredRowOrdering, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, org.apache.derby.iapi.sql.dictionary.AliasDescriptor, .TableDescriptor, .ConglomerateDescriptor, .UniqueTupleDescriptor, org.apache.derby.iapi.util.IdUtil, .JBitSet, org.w3c.dom.Document, .Element

Optimizer tracer which produces output in an xml format.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private ContextManager
private XMLOptTrace.QueryBlock
private Element
private int
private Document
private LanguageConnectionContext
private int
private Stack<XMLOptTrace.QueryBlock>
private Element
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
pack-priv static final String
pack-priv static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public
XMLOptTrace()

0-arg constructor required by OptTrace contract

Method Summary

Modifier and TypeMethod and Description
private Element
createElement(Element parent, String tag, String content)

Create an element and add it to a parent

private void
formatCost(Element costElement, CostEstimate raw)

Format a CostEstimate as subelements of a parent

private void
formatJoinOrder(Element parent, int[] proposedJoinOrder)

Format a join order list

private Element
formatPlanCost(Element parent, String type, int[] planOrder, int planType, CostEstimate raw)

Turn a CostEstimate for a join order into a human-readable element

private String
formatPlanSummary(int[] planOrder, int planType)

Produce a string representation of the plan being considered now.

private void
formatSelectivity(Element parent, String tag, int count, double selectivity)

Format selectivity subelement

private Element
formatSkip(Element parent, String skipTag, String reason)

Create an element explaining that we're skipping some processing

private String
formatTimestamp(long timestamp)

Turn a timestamp into a human-readable string

private Optimizable
getOptimizable(int tableNumber)

Get the Optimizable with the given tableNumber

private TableName
getOptimizableName(Optimizable optimizable)

Get the name of an optimizable

private boolean
isBaseTable(Optimizable optimizable)

Return true if the optimizable is a base table

private boolean
isComplete(int[] joinOrder)

Return true if the join order has been completely filled in

private boolean
isFromTable(Optimizable optimizable)

Return true if the optimizable is a FromTable

private TableName
makeTableName(String schemaName, String unqualifiedName, ContextManager cm)

Make a TableName

private void
printThrowable(Throwable t)

Print an exception to the log file

public void
public void
traceAddingUnorderedOptimizable(int predicateCount)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceAddingUnorderedOptimizable.

Say that we're adding an unordered optimizable.

public void
traceChangingAccessPathForTable(int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceChangingAccessPathForTable.

Say that we're considering a different access path for a table.

public void
traceCheapestPlanSoFar(int planType, CostEstimate currentCost)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCheapestPlanSoFar.

Report the cost of the cheapest plan so far.

public void
public void
traceCompositeSelectivityFromStatistics(double statCompositeSelectivity)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCompositeSelectivityFromStatistics.

Report the selectivity calculated from SYSSTATISTICS.

public void
traceConsideringConglomerate(ConglomerateDescriptor cd, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceConsideringConglomerate.

Report that we are considering a conglomerate for a table.

public void
traceConsideringJoinStrategy(JoinStrategy js, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceConsideringJoinStrategy.

Say that we're considering a particular join strategy on a particular table.

public void
traceConstantStartStopPositions()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceConstantStartStopPositions.

Say that we're setting the lock mode to MODE_RECORD because the start and stop positions are all constant.

public void
traceCostIncludingCompositeSelectivityFromStats(CostEstimate cost, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostIncludingCompositeSelectivityFromStats.

Report the cost based on selectivities coming out of SYSSTATISTICS.

public void
traceCostIncludingExtra1stColumnSelectivity(CostEstimate cost, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostIncludingExtra1stColumnSelectivity.

Report the cost of a scan given the selectivity of an extra first column.

public void
public void
public void
traceCostIncludingExtraStartStop(CostEstimate cost, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostIncludingExtraStartStop.

Report the cost if we include an extra start/stop.

public void
traceCostIncludingStatsForIndex(CostEstimate cost, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostIncludingStatsForIndex.

Report the cost based on index statistics.

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)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostOfConglomerateScan.

Report the cost of a conglomerate scan.

public void
traceCostOfNoncoveringIndex(CostEstimate cost, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostOfNoncoveringIndex.

Report the cost of using a non-covering index.

public void
traceCostOfNScans(int tableNumber, double rowCount, CostEstimate cost)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostOfNScans.

Report the cost of scanning a table a certain number of times

public void
public void
traceCostWithSortAvoidance(CostEstimate currentSortAvoidanceCost)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCostWithSortAvoidance.

Report the cost with sort avoidance.

public void
traceCurrentPlanAvoidsSort(CostEstimate bestCost, CostEstimate currentSortAvoidanceCost)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceCurrentPlanAvoidsSort.

Say that the current plan avoids a sort.

public void
traceEndQueryBlock()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceEndQueryBlock.

End tracing the optimization of a query block.

public void
traceEstimatingCostOfConglomerate(ConglomerateDescriptor cd, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceEstimatingCostOfConglomerate.

Report the cost of using a particular conglomerate to scan a table.

public void
traceHashKeyColumns(int[] hashKeyColumns)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceHashKeyColumns.

Report the columns being traced

public void
traceIllegalUserJoinOrder()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceIllegalUserJoinOrder.

Say that the user specified an impossible join order.

public void
traceJoinOrderConsideration(int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceJoinOrderConsideration.

Say that we're considering a join order.

public void
traceLookingForSpecifiedIndex(String indexName, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceLookingForSpecifiedIndex.

Say that we're looking for an index specified by optimizer hints.

public void
traceModifyingAccessPaths(int optimizerID)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceModifyingAccessPaths.

Say that we're modifying access paths.

public void
traceNextAccessPath(String baseTable, int predicateCount)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceNextAccessPath.

Report that we are advancing to the next access path for the table.

public void
traceNoBestPlan()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceNoBestPlan.

Say that we couldn't find a best plan.

public void
traceNoMoreConglomerates(int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceNoMoreConglomerates.

Say that we have exhausted the conglomerate possibilities for a table.

public void
traceNonCoveringIndexCost(double cost, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceNonCoveringIndexCost.

Say that we're considering a non-covering index.

public void
traceNoStartStopPosition()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceNoStartStopPosition.

Say that we're setting the lock mode to MODE_TABLE because there is no start/stop position.

public void
traceOptimizingJoinNode()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceOptimizingJoinNode.

Say that we're starting to optimize a join node

public void
traceRememberingBestAccessPath(AccessPath accessPath, int tableNumber, int planType)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceRememberingBestAccessPath.

Report that we've found a best access path.

public void
public void
traceRememberingBestJoinOrder(int joinPosition, int[] bestJoinOrder, int planType, CostEstimate planCost, JBitSet assignedTableMap)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceRememberingBestJoinOrder.

Say that we are remembering the current plan as the best join order so far.

public void
public void
traceRememberingBestUnknownAccessPathSubstring(AccessPath ap, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceRememberingBestUnknownAccessPathSubstring.

Report an optimizer failure, e.g., while optimizing an outer join

public void
traceRememberingJoinStrategy(JoinStrategy joinStrategy, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceRememberingJoinStrategy.

Say that we've found a new best join strategy for the table.

public void
traceScanningHeapWithUniqueKey()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceScanningHeapWithUniqueKey.

Say that we're considering scanning a heap even though we have a unique key match.

public void
traceShortCircuiting(boolean timeExceeded, Optimizable thisOpt, int joinPosition)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceShortCircuiting.

Say that we short-circuited a join order.

public void
traceSingleMatchedRowCost(double cost, int tableNumber)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceSingleMatchedRowCost.

Report the cost of a scan which will match exactly one row.

public void
traceSkipHashJoinNoHashKeys()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceSkipHashJoinNoHashKeys.

Say we won't consider a hash join because there are no hash key columns.

public void
traceSkippingBecauseTooMuchMemory(int maxMemoryPerTable)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceSkippingBecauseTooMuchMemory.

Say that we are skipping a plan because it consumes too much memory.

public void
traceSkippingJoinOrder(int nextOptimizable, int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceSkippingJoinOrder.

Say that we're skipping the join order starting with the next optimizable.

public void
traceSkipUnmaterializableHashJoin()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceSkipUnmaterializableHashJoin.

Say that we won't consider a hash join because the result can't be materialized

public void
public void
traceSortNeededForOrdering(int planType, RequiredRowOrdering requiredRowOrdering)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceSortNeededForOrdering.

Report that this plan needs a sort

public void
traceStartQueryBlock(long timeOptimizationStarted, int optimizerID, OptimizableList optimizableList)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceStartQueryBlock.

Start optimizer tracing for a query block.

public void
traceStartStatement(String statementText)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceStartStatement.

Start the start of tracing a statement.

public void
traceTimeout(long currentTime, CostEstimate bestCost)

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceTimeout.

Say that the optimizer ran out of time.

public void
traceUserJoinOrderOptimized()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceUserJoinOrderOptimized.

Say that we have optimized the user-specified join order.

public void
traceVacuous()

Implements org.apache.derby.iapi.sql.compile.OptTrace.traceVacuous.

Say that there's nothing to optimizer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait