Home | Previous Page | Next Page   Creating User-Defined Routines > Extending Data Types >

Providing Statistics Data for a Column

The database server can provide statistics data for the columns of a table. This statistics data describes the distribution of the values within a column. The query optimizer uses this statistics data to determine the best path for an SQL statement. With this information, the optimizer can estimate the effect of a WHERE clause by examining, for each column included in the WHERE clause, the proportionate occurrence of data values contained in the column. (For more information about statistics data and the optimizer, see your IBM Informix: Performance Guide.)

The database server provides the following support for column statistics data:

However, the database server can only provide this support for columns with built-in data types. For the database server to support statistics data for a column with a user-defined data type, you must write special UDRs that collect and print the statistics data.

DBDK

BladeSmith can automatically generate user-defined statistics for an opaque data type in a statistics.c file. This file contains the following user-defined functions.

Statistics Function
Purpose
OpaqueStatCollect( )
The statcollect( ) function for the Opaque data type
OpaqueStatPrint( )
The statprint( ) function for the Opaque data type

These functions are not complete. You must add code to handle the statistics data to these functions for them to compile and execute.

End of DBDK
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]