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.
REPLACE PROCEDURE TDSTATS.ResyncStats ( IN DatabaseName VARCHAR(128) CHARACTER SET UNICODE, IN TableName VARCHAR(128) CHARACTER SET UNICODE, OUT AutomateId BIGINT, OUT NumRemoved INTEGER ) ... ;
- Name of the database. DatabaseName limits the operation to statistics defined in the database you specify.
- Name of the table. TableName limits the operation to the table you specify.
- ID for the history results from this operation.
- Number of statistics removed from the TDSTATS database and the number of rows repaired.
By default, the ResyncStats external stored procedure operates on all statistic definitions defined in the TDSTATS database.
- 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
- ResyncStats with DatabaseName and TableName specified as NULL.
- AutomateStats with DeleteOrphans specified as Y.
Example: Using ResyncStats
The following example shows how to synchronize the statistics for the Personnel.Employee table.
CALL TDSTATS.ResyncStats('Personnel','Employee',AutomateId, NumRemovedOrRepaired);