UpdateStatHistogramSettings Stored Procedure | Teradata Vantage - UpdateStatHistogramSettings - Teradata Vantage - Analytics Database

Application Programming Reference

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
qld1628112131956.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
ajo1472244909562
lifecycle
latest
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.

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

Result:

*** Procedure has been executed.
*** Total elapsed time was 1 second.
 NumUpdated
-----------
          1