| java.lang.Object org.apache.derby.impl.store.access.sort.ExternalSortFactory
Method Summary | |
public void | boot(boolean create, Properties startParams) | public boolean | canSupport(Properties startParams) | public void | close() | public Sort | createSort(TransactionController tran, int segment, Properties implParameters, DataValueDescriptor[] template, ColumnOrdering columnOrdering, SortObserver sortObserver, boolean alreadyInOrder, long estimatedRows, int estimatedRowSize) Create a sort. | public Properties | defaultProperties() There are no default properties for the external sort.. | public double | getSortCost(DataValueDescriptor[] template, ColumnOrdering columnOrdering, boolean alreadyInOrder, long estimatedInputRows, long estimatedExportRows, int estimatedRowSize) Short one line description of routine.
The sort algorithm is a N * log(N) algorithm. | public SortCostController | openSortCostController() Return an open SortCostController. | public UUID | primaryFormat() | public String | primaryImplementationType() | public void | stop() | public boolean | supportsFormat(UUID formatid) | public boolean | supportsImplementation(String implementationId) |
DEFAULT_MAX_MERGE_RUN | final protected static int DEFAULT_MAX_MERGE_RUN(Code) | | |
DEFAULT_MEM_USE | final protected static int DEFAULT_MEM_USE(Code) | | |
close | public void close()(Code) | | |
createSort | public Sort createSort(TransactionController tran, int segment, Properties implParameters, DataValueDescriptor[] template, ColumnOrdering columnOrdering, SortObserver sortObserver, boolean alreadyInOrder, long estimatedRows, int estimatedRowSize) throws StandardException(Code) | | Create a sort.
This method could choose among different sort options,
depending on the properties etc., but currently it always
returns a merge sort.
See Also: SortFactory.createSort |
getSortCost | public double getSortCost(DataValueDescriptor[] template, ColumnOrdering columnOrdering, boolean alreadyInOrder, long estimatedInputRows, long estimatedExportRows, int estimatedRowSize) throws StandardException(Code) | | Short one line description of routine.
The sort algorithm is a N * log(N) algorithm. The following numbers
on a PII, 400 MHZ machine, jdk117 with jit, insane.zip. This test
is a simple "select * from table order by first_int_column. I then
subtracted the time it takes to do "select * from table" from the
result.
number of rows elaspsed time in seconds
-------------- -----------------------------
1000 0.20
10000 10.5
100000 80.0
We assume that the formula for sort performance is of the form:
performance = K * N * log(N). Solving the equation for the 1000
and 100000 case we come up with:
performance = 1 + 0.08 N ln(n)
NOTE: Apparently, these measurements were done on a faster machine
than was used for other performance measurements used by the optimizer.
Experiments show that the 0.8 multiplier is off by a factor of 4
with respect to other measurements (such as the time it takes to
scan a conglomerate). I am correcting the formula to use 0.32
rather than 0.08.
- Jeff
RESOLVE (mikem) - this formula is very crude at the moment and will be
refined later. known problems:
1) internal vs. external sort - we know that the performance of sort
is discontinuous when we go from an internal to an external sort.
A better model is probably a different set of contants for internal
vs. external sort and some way to guess when this is going to happen.
2) current row size is never considered but is critical to performance.
3) estimatedExportRows is not used. This is a critical number to know
if an internal vs. an external sort will happen.
The identifier to be used to open the conglomerate later. exception: StandardException - Standard exception policy. |
|
|