DoNotPreserveAfterRecreate Stored Procedure | Teradata Vantage - DoNotPreserveAfterRecreate - Advanced SQL Engine - Teradata Database

Application Programming Reference

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
hvk1593628831140.ditamap
dita:ditavalPath
hvk1593628831140.ditaval
dita:id
B035-1090
lifecycle
previous
Product Category
Teradata Vantageā„¢

Marks one or more automated statistics as no longer eligible for having their TDStats stored metadata preserved after their owning table is temporarily dropped and then recreated. The qualifying automated statistics are then "unpreserved."

Syntax

REPLACE PROCEDURE TDSTATS.DoNotPreserveAfterRecreate (
  IN DatabaseName VARCHAR(128) CHARACTER SET UNICODE,
  IN ObjectName VARCHAR(128) CHARACTER SET UNICODE,
  IN ObjectListName VARCHAR(128) CHARACTER SET UNICODE,
  OUT NumNotPreserved INTEGER
)
  ...
;

Syntax Elements

DatabaseName
Database whose automated statistics should no longer be marked for preservation.
ObjectName
Table within DatabaseName whose statistics should no longer be marked for preservation.
ObjectListName
Object list whose defined databases and tables should no longer be marked for preservation.
NumNotPreserved
Number of statistics marked no longer eligible for preservation.

Usage Notes

This API is typically called to reverse the actions taken by a prior call to the related API PreserveAfterRecreate. For more information, see PreserveAfterRecreate. Unpreserved is the default state for all automated statistics, so it is not necessary to call DoNotPreserveAfterRecreate unless it is to undo a prior call to PreserveAfterRecreate.

To unpreserve all tables within a given database for preservation, callers should specify a value for input parameter DatabaseName. To further limit the action to a single table, callers should also specify a value for input parameter ObjectName.

To unpreserve the set of databases or tables defined within a previously created object list, callers should specify a value for input parameter ObjectListName. For information on how to create an ObjectListName, see CreateObjectList.

The values of input parameters DatabaseName and ObjectListName cannot both be NULL. Callers must specify a non-NULL for one of them.

If not marked for preservation, the TDStats entries for dropped and recreated tables become orphaned from the Data Dictionary and the associated statistics can no longer be managed through Automated Statistics Management APIs. See Statistics from Dropped and Recreated Objects for more information.

Example: Using DoNotPreserveAfterRecreate

The following example shows how to mark the automated statistics for the Personnel.Employee table as no longer eligible for preservation.

CALL TDSTATS.DoNotPreserveAfterRecreate('Personnel','Employee', NULL, NumNotPreserved);
*** Procedure has been executed.
*** Total elapsed time was 1 second.
NumNotPreserved
---------------
              4