Collect Statistics Syntax in Teradata

The following are the Collect Statistics Syntaxes in Teradata.

“COLLECT STATISTICS ON tablename COLUMN columnname;” will collect statistics  on a column.

                .
“COLLECT STATISTICS ON tablename INDEX (columnname)” will collect statistics  on an index.
                    
“COLLECT STATISTICS ON tablename INDEX (col1, col2, ...)” will collect statistics  on multiple columns of an index.                      

“HELP STATISTICS tablename;” will display the number of distinct values of the columns. 
                        
“COLLECT STATISTICS tablename;” refreshes (recollects) the table statistics.

 “DROP STATISTICS ON tablename ... ;" will drop the statistics.


5 comments:

  1. Very useful commands for beginners. Thank you

    ReplyDelete
  2. can i get brief explanation with example.

    ReplyDelete
    Replies
    1. Read the following links

      http://www.teradata-sql.com/2012/03/collect-statistics.html
      http://www.teradata-sql.com/2012/06/list-of-interview-questions-on-collect.html

      Delete