UpdateStatHistogramSettings Stored Procedure | Teradata Vantage - UpdateStatHistogramSettings - Advanced SQL Engine - Teradata Database

Application Programming Reference

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
cpn1571792172880.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1090
lifecycle
previous
Product Category
Teradata Vantage™

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