The statistics minimum, maximum, and distribution functions

The Opaque_SetMinValue() function computes the minimum value of the Opaque data type.

The Opaque_SetMaxValue() function computes the maximum value of the Opaque data type.

The Opaque_SetHistogram() function computes the distribution of the values of the Opaque data type.

The generated code

BladeSmith generates only function stubs for the Opaque_SetMinValue(), Opaque_SetMaxValue(), and Opaque_SetHistogram() functions.

Complete the code

To complete the code for the statistics support functions, you must add code to compute the minimum, maximum, and distribution of the values of your opaque data type.

When the database server computes the minimum, maximum, and distribution of values for built-in data types, it uses the standard ASCII sequence to order the values. However, opaque data types can be much more complicated. For example, suppose you have a box opaque data type that contains values for its height and its width. You might decide that area of the box is an appropriate measure for determining the minimum and maximum values. The distribution, however, can be more complicated. If the area of the boxes varies, then area might be the appropriate way to assign boxes to bins. If the areas of your boxes are all similar, but the heights and widths vary, then height or width might be the best distribution criteria.

Example

The Box DataBlade® module has an example of statistics support routines.