UpdateStatThresholdSetting Stored Procedure | Teradata Vantage - 17.10 - UpdateStatThresholdSetting - 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 THRESHOLD settings to include when preparing and executing SQL COLLECT STATISTICS statements on selected statistics or objects.

Syntax

REPLACE PROCEDURE TDSTATS.UpdateStatThresholdSetting (
  IN  SCOID            BIGINT,
  IN  DatabaseName     VARCHAR(128) CHARACTER SET UNICODE,
  IN  TableName        VARCHAR(128) CHARACTER SET UNICODE,
  IN  ThresholdType    CHAR(1) CHARACTER SET LATIN,
  IN  AgeThreshold     INTEGER,
  IN  GrowthThreshold  INTEGER,
  IN  ForCurrentlyOnly CHAR(1) CHARACTER SET LATIN,
  OUT NumUpdated       INTEGER
)
  ...
;

Syntax Elements

SCOID
TDSTATS ID of an individual statistic whose THRESHOLD settings are to be changed.
This input parameter cannot be NULL.
DatabaseName
DatabaseName limits the new settings that will be applied to all statistics collected within the database you specify.
This input parameter cannot be NULL.
TableName
Name of the table within the specified DatabaseName. TableName limits the new settings to statistics collected on the table you specify within DatabaseName.
ThresholdType
Type of threshold option change:
  • S means SYSTEM THRESHOLD
  • U means THRESHOLD <AgeThreshold> DAYS AND THRESHOLD <GrowthThreshold> PERCENT
  • N means no threshold.
When specifying the U option, you must also specify a value other than NULL for the AgeThreshold or GrowthThreshold input parameter, or both.

For more information about the COLLECT STATISTICS THRESHOLD option, see Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144 or Teradata Vantage™ - Database Administration, B035-1093.

AgeThreshold
User-supplied age threshold in number of days.
This input parameter is valid only when SampleType is U. For more information about the SampleType input parameter, see UpdateStatSampleSetting.
A NULL or zero value indicates a no age threshold.
GrowthThreshold
User-supplied growth threshold as a percentage.
This input parameter is valid only when SampleType is U. For more information about the SampleType input parameter, see UpdateStatSampleSetting.
A NULL or zero value indicates a no growth threshold.
ForCurrentlyOnly
Possible values:
  • Y. If you specify Y, the THRESHOLD setting will be issued along with the FOR CURRENT option making it applicable to the current collection only.
  • N or NULL. If you specify N or NULL, the THRESHOLD setting is applied to all future collections.
For more information about the THRESHOLD FOR CURRENT option, see Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.
NumUpdated
Number of statistics whose THRESHOLD settings have been updated.
For more information about the THRESHOLD option, see SQL COLLECT STATISTICS in Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144 or Teradata Vantage™ - Database Administration, B035-1093.

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. When specifying a value for SCOID, you do not need to specify a value for DatabaseName or TableName.
all statistics for a particular database DatabaseName.
This input parameter cannot be NULL.
all statistics for a particular table both DatabaseName and TableName.

Example: Using UpdateStatThresholdSetting

The following example shows how to specify a ThresholdType option (for example, THRESHOLD 10 PERCENT AND THRESHOLD 7 DAYS) when collecting statistics on the individual statistic whose TDSTATS database ID is 103.

CALL TDSTATS.UpdateStatThresholdSetting(103, 'Personnel', 'Employee', 'U', 7, 10, NULL, NumUpdated);
*** Procedure has been executed.
 *** Total elapsed time was 1 second.
 NumUpdated
-----------
          1