16.20 - ResyncStats - 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

Removes statistics definitions stored in the TDSTATS database that no longer exist in the dictionary as a result of a SQL DROP statement. In the case of objects marked for preservation after dropping and recreating, the statistics definitions are repaired rather than removed; see related API PreserveAfterRecreate.

Definition

REPLACE PROCEDURE TDSTATS.ResyncStats(
 IN DatabaseName VARCHAR(128) CHARACTER SET UNICODE,
 IN TableName    VARCHAR(128) CHARACTER SET UNICODE,
 OUT AutomateId  BIGINT,
 OUT NumRemoved  INTEGER)
       .
       .
       .
       .
;

Input Parameters

Parameter Description
DatabaseName Name of the database. DatabaseName limits the operation to statistics defined in the database you specify.
TableName Name of the table. TableName limits the operation to the table you specify.

Usage Notes

By default, the ResyncStats external stored procedure operates on all statistic definitions defined in the TDSTATS database.

Teradata recommends running ResyncStats when the following occurs:
  • Statistics definitions are automated and dropped as a result of a SQL DROP STATISTICS statement or an ARC restore operation.
  • The RunCollectReport external stored procedure reports errors from collections issued on statistics that no longer exist in the dictionary

Synchronizing the TDSTATS Database

To synchronize the TDSTATS database, you can call one of the following external stored procedures:
  • ResyncStats with DatabaseName and TableName specified as NULL.
  • AutomateStats with DeleteOrphans specified as Y.
To copy additional statistics definitions from DBC to the TDSTATS database, use the AutomateStats external stored procedure. For details, see AutomateStats.

Output Parameters

Parameter Description
AutomateId ID for the history results from this operation.
NumRemoved Number of statistics removed from the TDSTATS database and the number of rows repaired.

Example: Using ResyncStats

The following example shows how to synchronize the statistics for the Personnel.Employee table.

CALL TDSTATS.ResyncStats('Personnel','Employee',AutomateId, NumRemovedOrRepaired);

Related Topics

For more information on the ... See ...
SQL DROP STATISTICS statement Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.
ARC restore operation Teradata® Archive/Recovery Utility Reference, B035-2412.
RunCollectReport external stored procedure RunCollectReport.
DeleteOrphans input parameter or copying statistics AutomateStats.