15.10 - Preparing and Collecting Statistics - Teradata Database

Teradata Database Application Programming Reference

Teradata Database
Programming Reference

You can use the set of Collect-related APIs to prepare and submit COLLECT STATISTICS commands on the automated statistic definitions stored in the TDSTATS database.

The collection process is divided into two phases:

  • The prepare phase allows you to view and modify a prepared collection list prior to its actual submission. Each list of collection commands generated by a call to the PrepCollect open API is assigned a unique ID which is passed to the RunCollect open API to execute the list.
  • The run phase allows you to specify a time limit. When the specified time expires, RunCollect will stop issuing any additional collections. If the specified time expires, you can resume the prior execution at a later time.
  • Although Teradata recommends that you call the PrepCollect open API before every call to RunCollect to incorporate the latest stale or missing statistics information, you can reuse the same list of collection commands in consecutive calls to RunCollect.

    For more information, see “PrepCollect” on page 546 or “RunCollect” on page 550.


    If you want to ...

    Use the following SQL interface ...

    prepare a prioritized list of COLLECT STATISTICS commands suitable for an execution or Run operation.

    “PrepCollect” on page 546.

    execute the list of COLLECT STATISTICS commands generated by the PrepCollect open API

    “RunCollect” on page 550.

    prepare and immediately execute collections on the automated statistics for a specified table

    “ReCollectTable” on page 553.

    report a summarized list of pending, in-progress, and completed collections for an execution run

    “RunCollectReport” on page 555.

    display the list of collection commands generated by the PrepCollect open API

    “SelectPreparedCollects” on page 559.

    display a list of completed collections for one or more past execution runs

    “SelectStatsExecutionHistory” on page 562.

    abort pending or in-progress collections from an in-progress RunCollect

    “AbortCollect” on page 566.