15.10 - TruncateAutomateHistory - Teradata Database

Teradata Database Application Programming Reference

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
featnum
B035-1090-151K

Truncates rows from the TDSTATS.AutomateHistoryTbl table.

REPLACE PROCEDURE TDSTATS.TruncateAutomateHistory
  (IN OlderThan      TIMESTAMP(6) WITH TIME ZONE,
   IN DatabaseName   VARCHAR(128) CHARACTER SET UNICODE,
   IN TableName      VARCHAR(128) CHARACTER SET UNICODE,
   IN ObjectListName VARCHAR(128) CHARACTER SET UNICODE,
   IN AutomateId     BIGINT,
   OUT DeletedRows   INTEGER)
           .
           .
           .
;
 

Parameter

Description

OlderThan

Time. OlderThan deletes the automate history data older than the time you specify.

Note: If you specify NULL, time is not used as a qualifier for deletion.

DatabaseName

Name of the database. DatabaseName limits the deletion to rows associated with the database you specify.

TableName

Name of the table within the specified DatabaseName. TableName limits the deletion to rows associated with the table you specify within DatabaseName.

ObjectListName

Name of the object list. ObjectListName deletes rows associated with the objects (that is, one or more database names or fully qualified table names where each name entry may optionally contain wildcard characters) in the list you specify.

For more information about this input parameter, see “Usage Notes” or “CreateObjectList” on page 603.

AutomateId

Automate results ID. AutomateId deletes results associated with the Automate results ID you specify.

You must periodically run TruncateAutomateHistory to prevent the TDSTATS.AutomateHistoryTbl table from consuming an excessive amount of space.

Specifying the Results to Remove

Notice:

If you specify NULL for one of the following input parameters, all rows will be truncated.

 

To remove results ...

You must specify a value for ...

from a particular Automate-related call or results that older than the specified time

AutomateId or OlderThan.

on a particular object

both DatabaseName and TableName.

for a particular named object list

ObjectListName that was previously created by the CreateObjectList and AddObjectListEntry external stored procedures.

Note: ObjectListName usage is mutually exclusive with DatabaseName and TableName. When you specify a value other than NULL for ObjectListName, DatabaseName and TableName must be NULL.

 

Parameter

Description

DeletedRows

Number of deleted rows.

The following example shows how to remove all Automate-related results that are older than one year.

CALL TDSTATS.TruncateAutomateHistory (CAST(CURRENT_DATE - INTERVAL '1' YEAR AS TIMESTAMP(6)), NULL, NULL, NULL,NULL, DeletedRows);
 
*** Procedure has been executed. 
 *** Total elapsed time was 1 second.
 
DeletedRows
-----------
        300