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

Teradata Vantage™ - Application Programming Reference

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1090-171K
Language
English (United States)

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

Syntax

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
)
  ...
;

Syntax Elements

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.
NumUpdated
Number of statistics whose histogram settings have been updated.

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.

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