Adds a user specified COLLECT STATISTICS statement to an already prepared list of collections generated by PrepCollect.
Syntax
REPLACE PROCEDURE TDSTATS.AddPreparedCollect ( IN CmdListID BIGINT, IN CmdListName VARCHAR(128) CHARACTER SET UNICODE, IN Priority INTEGER, IN StatsType CHAR(1) CHARACTER SET LATIN, IN DatabaseName VARCHAR(128) CHARACTER SET UNICODE, IN TableName VARCHAR(128) CHARACTER SET UNICODE, IN CollectText VARCHAR(10000) CHARACTER SET UNICODE, OUT NumAdded INTEGER ) ... ;
Syntax Elements
- CmdListID
- Commands list ID as assigned from prior call to PrepCollect.
- CmdListName
- User-named commands list as specified in a prior call to PrepCollect.
- Priority
- Priority of the added collection. The value is expressed as a relative rank among other collections in the same commands list.
- StatsType
- This input parameter is reserved for future use.
- DatabaseName
- Name of the database containing the statistic to be collected.
- TableName
- Name of the table on whose columns statistics are collected.
- CollectText
- User-specified COLLECT STATISTICS statement text.
- NumAdded
- Possible values:
- 1 means the operation was successful.
- 0 means the operation failed.
Usage Notes
You can use the AddPreparedCollect external stored procedure to customize a system generated commands list with additional collections.
The added collection is only stored in the specified commands list. Future invocations of PrepCollect will not incorporate the added collection in its generated commands lists.
To permanently automate the collection, you must call AutomateSingleStat or AutomateStats.
Identifying a Command List
To identify ... | You must ... |
---|---|
the commands list being executed | specify a value that is not null for either CmdListID or CmdListName. |
a commands list by CmdListName | assign it during a prior call to PrepCollect. |
Collecting Statistics
To collect statistics for a particular object, you must specify a value for both DatabaseName and TableName in case the RemovedPreparedCollect external stored procedure is subsequently called.
Example: Using AddPreparedCollect
The following example shows how to add a collection on the Personnel.JobTitle table to the assigned number command list ID generated by PrepCollect (for example, 3).
CALL TDSTATS.AddPreparedCollect(3, NULL, 1, NULL, 'Personnel', 'Employee, 'Collect Statistics Column(JobTitle) On Personnel.Employee', NumAdded); *** Procedure has been executed. *** Total elapsed time was 1 second. NumAdded --------- 1
Related Information
For more information ... | See ... |
---|---|
automating the collection permanently | |
on removing one or more collections | RemovePreparedCollect. |