Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
ANALYZE TABLE Table1 PARTITION(ds='2008-04-09', hr) COMPUTE STATISTICS FOR COLUMNS;

then column statistics are gathered for all columns for  partition (ds='2008-04-09', hr=11)

If the user issues the command:

Code Block
ANALYZE TABLE Table1 PARTITION(ds='2008-04-09', hr) COMPUTE STATISTICS;

then statistics are gathered for partitions 3 and 4 only.

If the user issues the command:

Code Block
ANALYZE TABLE Table1 PARTITION(ds='2008-04-09', hr) COMPUTE STATISTICS FOR COLUMNS;

then column statistics for all columns are gathered for partitions 3 and 4 only.

...

then statistics are gathered for the 4 partitionsfour partitions.

If the user issues the command:

Code Block
ANALYZE TABLE Table1 PARTITION(ds, hr) COMPUTE STATISTICS FOR COLUMNS;

then column statistics for all columns are gathered for four partitions.

For a non-partitioned table, you can issue the command:

Code Block
ANALYZE TABLE Table1 COMPUTE STATISTICS;

to gather statistics of the table.

For a non-partitioned table, you can issue the command:

Code Block
ANALYZE TABLE Table1 COMPUTE STATISTICS FOR COLUMNS;

to gather column statistics of the table.

If Table1 Table is a partitioned table,  then for basic statistics you have to specify partition specifications like above in analyze statement. Otherwise a semantic analyzer exception will be thrown.

However for column statistics, if no partition specification is given in analyze statement, statistics for all partitions are computed.

The user can view the stored statistics by issuing the DESCRIBE command. Statistics are stored in the Parameters array. Suppose the user issues the analyze command for the whole table Table1, then issues the command:

...