ResyncStats Stored Procedure | Application Programming Reference | Teradata Vantage - ResyncStats - 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ā„¢

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.