Display statistics data

The dbschema utility with its -hd option displays statistics data for tables in your database. It can automatically display statistics for all columns with built-in data types (except TEXT and BYTE). It cannot automatically collect statistics for columns with user-defined data types because it does not know the structure of these data types.

For dbschema -hd to display statistics for a column with a user-defined data type, you must write a user-defined function named statprint() that generates text output of the statistics collected for your user-defined data type. The dbschema -hd command obtains the user-defined statistics from the encdat column of the sysdistrib system catalog table. The encdat column stores the statistics data in the stat opaque type. Therefore, dbschema must call the statprint() function for your user-defined data type to convert the statistics data from the stat data type to an LVARCHAR value that can be displayed.

To provide display statistics for your user-defined data type, you must:
  • Define a C statistics-display function to implement the statistics display.
  • Convert the user-defined statistics for the column to text output within statistics-display function.
  • Register this C function as a statprint() user-defined function.