COLLECT STATISTICS Syntax | Teradata Vantage - 17.10 - COLLECT STATISTICS Syntax (Optimizer Form) - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)
COLLECT [ SUMMARY ] { STATISTICS | STAT }
  [ USING using_option [ AND using_option ][...] ]
  [ [ UNIQUE ] INDEX index_specification | COLUMN column_specification ][...]
  ON collection_source FROM from_option [;]
using_option
{ SAMPLE | SYSTEM SAMPLE | SAMPLE n PERCENT | NO SAMPLE |

  { SYSTEM THRESHOLD | THRESHOLD n | NO THRESHOLD } [ PERCENT | DAYS ] |
  
  MAXINTERVALS n |

  SYSTEM MAXINTERVALS |
  
  MAXVALUELENGTH n |

  SYSTEM MAXVALUELENGTH
  
 } [ FOR CURRENT ]
index_specification
{ index_name |

  [ index_name ] [ ALL ] ( column_name_1 [,...] )
    [ ORDER BY { VALUES | HASH } ( column_name_2 ) ]
}
column_specification
{ { expression |
    column_name |
    ( { expression | column_name | PARTITION }[,...] )
  } [ [AS] statistics_name ] |

  PARTITION |

  statistics_name
}
collection_source
{ [ TEMPORARY ] [ database_name. | user_name. ] table_name_1 |

  [ database_name. | user_name. ] { join_index_name | hash_index_name } 
}
from_option
{ [ TEMPORARY ] [ database_name. | user_name. ] table_name_2 |
  [ database_name. | user_name. ] { join_index_name | hash_index_name }   
} [ COLUMN {
      { column_name_3 | PARTITION } |
      statistics_name |
      ( { column_name | PARTITION }[,...] )
    }
  ]