16.20 - UpdateStatHistogramSettings - Teradata Vantage NewSQL Engine

Teradata Vantage™ Application Programming Reference

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
created_date
March 2019
category
Programming Reference
featnum
B035-1090-162K

Records the user specified MAXINTERVAL or MAXVALUELENGTH setting to include when preparing and executing the SQL COLLECT STATISTICS statements on selected statistics or objects.

Definition

REPLACE PROCEDURE TDSTATS.UpdateStatHistogramSettings
 (IN SCOID BIGINT,
  IN DatabaseName        VARCHAR(128) CHARACTER SET UNICODE,
  IN TableName           VARCHAR(128) CHARACTER SET UNICODE,
  IN MaxIntervals        INTEGER,
  IN MaxValueLength      INTEGER,
  OUT NumUpdated         INTEGER)
           .
           .
           .
;

Input Parameters

Parameter Description
SCOID TDSTATS ID of an individual statistic whose histogram settings are to be changed.
DatabaseName Name of the database. DatabaseName limits the new settings applied to all statistics collected within the database you specify.
TableName Name of the table within the specified DatabaseName. TableName limits the new settings to statistics collected on the table you specify within DatabaseName.
MaxIntervals Maximum number of histogram intervals used for collected statistics.

A value of -1 indicates the SYSTEM selected value is used. For more information, see the COLLECT STATISTICS MAXINTERVALS option in Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.

MaxValueLength Maximum size for histogram values.

A value of -1 indicates the SYSTEM selected value is used. For information on the valid range of values, see the COLLECT STATISTICS MAXVALUELENGTH option in Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.

Usage Notes

The new collection settings will take effect during the next RunCollect operation involving the selected statistics. For more information, see RunCollect.

Updating Statistics

To update ... You must specify a value for ...
a single statistics collection SCOID.
This input parameter cannot be NULL.
all statistics for a specified database DatabaseName.
This input parameter cannot be NULL.
all statistics for a specified table both DatabaseName and TableName.

Output Parameter

Parameter Description
NumUpdated Number of statistics whose histogram settings have been updated.

Example: Using UpdateStatHistogramSettings

The following example shows how to specify a MAXINTERVALS value of 500 when collecting statistics on the individual statistic whose TDSTATS database ID is 102.

CALL TDSTATS.UpdateStatHistogramSettings(102, 'Personnel', 'Employee', 500, 0, NumUpdated);
*** Procedure has been executed.
*** Total elapsed time was 1 second.
 NumUpdated
-----------
          1