Teradata Collect Statistics

Teradata Collect Statistics

This tutorials will cover importance of collect statistics in Teradata, how to collect statistics and how to drop statistics.
Hereafter term 'stats' can be used for 'statistics'.


➠ Information collected by statistics

➠ Operations related to Collect Statistics, click on the line item to check its detail.
Recommendations for Collect Statistics

Restrictions for Collect Statistics
  1. Stats cannot be collected on columns with datatypes like BLOB, CLOB, JSON, XML and Period. If user tries to collect stats on these datatypes then it will fail with a error like below.
    *** Failure 6969 This statistics operation is not allowed on a Period column.
    
  2. Users will get below error while refreshing collect stats on Global Temporary Table(GTT) using general syntax. User should explicitly mention TEMPORARY keyword while collecting stats on a GTT.
    *** Failure 5343 This statement is not allowed when the target temporary table is already materialized.
    


Define Statistics
Check Collected Statistics Detail
Refresh Collected Statistics
Show Collected Statistics
Drop Collected Statistics
Set how statistics will be sampled: Teradata provides a way to define how statistics will be sampled.
Statistics on Built-in function expression: Teradata provides a way to collect statistics on custom user defined expression.
Optimizer's suggestion