ResyncStats Stored Procedure | Application Programming Reference | Vantage - 17.10 - ResyncStats - 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)

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.

Syntax

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

Syntax Elements

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.
AutomateId
ID for the history results from this operation.
NumRemoved
Number of statistics removed from the TDSTATS database and the number of rows repaired.

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.

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 Information

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.