Measuring the cost of Derby-style table functions

This topic shows how to measure the cost of a Derby-style table function.

The following formula describes how to estimate the value returned by VTICosting.getEstimatedCostPerInstantiation():

C = I * A

where

Calculating the optimizer's imprecision

We treat optimizer Imprecision as a constant across the runtime environment. The following formula describes it:

I = O / T

where

To estimate these values, turn on Derby statistics collection and run the following experiment several times, averaging the results:

For example:

MAXIMUMDISPLAYWIDTH 7000;

CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);
CALL SYSCS_UTIL.SYSCS_SET_STATISTICS_TIMING(1);

select * from T;

values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();

Calculating the actual runtime cost of a table function

The following formula explains how to compute the Actual runtime cost for the table function:

A = ( P * N ) + E

where

You may know that E is basically 0. If so, you can skip this step. Otherwise, to estimate E, turn on Derby statistics collection and run the following experiment several times, averaging the results:

To estimate P, turn on Derby statistics collection and run the following experiment several times, averaging the results:

Computing the value returned by getEstimatedCostPerInstantiation()

Putting all of this together, the following formula describes the value returned by your table function's VTICosting.getEstimatedCostPerInstantiation() method.

C = O/T * [ ( P * N ) + E ]