COLLECT STATISTICS Syntax | Teradata Vantage - 17.00 - 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.00
Release Date
September 2020
Content Type
Programming Reference
Publication ID
B035-1144-170K
Language
English (United States)
COLLECT [ SUMMARY ] { STATISTICS | STAT }
  [ USING using_option [ AND using_option ][...] ]
  [ [ UNIQUE ] INDEX index_specification | COLUMN column_specification_1 ][...]
  ON collection_source FROM from_option [;]

Syntax Elements

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_1
{ column_specification_2 [ [AS] statistics_name ] |
  PARTITION |
  statistics_name
}
column_specification_2
{ expression |
  column_name |
  ( { expression | column_name | PARTITION }[,...] )
}
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 from_column_specification ]
from_column_specification
{ { column_name_3 | PARTITION } |
  statistics_name |
  ( { column_name | PARTITION }[,...] )
}