ResyncStats Stored Procedure | Application Programming Reference | Vantage - 17.05 - ResyncStats - Teradata Database

Teradata Vantageā„¢ - Application Programming Reference

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
17.05
created_date
June 2020
category
Programming Reference
featnum
B035-1090-170K

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.
  • 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.
RunCollectReport external stored procedure RunCollectReport.
DeleteOrphans input parameter or copying statistics AutomateStats.