ttOptSetColStats

This procedure modifies the statistics for the specified columns. This procedure enables an application to set statistics manually rather than have TimesTen automatically compute them. This feature is useful for preparing commands before the data has been inserted or for seeing how table characteristics can affect the choice of execution plan. This procedure modifies the relevant row(s) in the COL_STATS system table.

Because this procedure can be used before the table is populated with data, the values specified do not need to bear any relation to the actual values, although some basic validity checking is performed.

Required Privilege

This procedure requires no privilege (if owner) or ALTER ANY TABLE privilege (if not owner).

Usage in TimesTen Scaleout and TimesTen Classic

This procedure is supported in TimesTen Classic.

TimesTen Scaleout applications can call this built-in procedure.

In TimesTen Scaleout, this procedure runs on all elements in the grid.

Related Views

This procedure has no related views.

Syntax

ttOptSetColStats('tblName', 'colName', numUniq, minVal,maxVal, 
 invalidate, numNull)

Parameters

ttOptSetColStats has these parameters:

Parameter Type Description

tblName

TT_CHAR(61) NOT NULL

Name of an application table. Can include table owner.

Using a synonym to specify a table name is not supported.

colName

TT_CHAR(30) NOT NULL

Name of a column in that table.

num_Uniq

TT_INTEGER NOT NULL

Number of unique values in the column.

minVal

VARBINARY(1024) NOT NULL

Minimum value in the column (possibly truncated).

maxVal

VARBINARY(1024) NOT NULL

Maximum value in the column (possibly truncated).

invalidate

TT_INTEGER

0 (no) or 1 (yes). If invalidate is 1, all commands that reference the affected tables are automatically prepared again when rerun. This includes commands prepared by other users. If invalidate is 0, the statistics are not considered to have been modified and existing commands are not reprepared.

num_Null

TT_INTEGER

Indicates the total number of NULLs in the column.

Result Set

ttOptSetColStats returns no results.

Examples

CALL ttOptSetColStats ('SALLY.ACCTS, 'BALANCE, 400, 
0x00001388, 0x000186A0, 1, 0);

Notes

  • You must specify the minimum and maximum values as VARBINARY. NULL values are not permitted as minimum or maximum values. The value is stored in the platform-specific endian format.

  • The statistics are treated as a single interval of column values that are uniformly distributed between the minimum value and the maximum value.