Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: edit examples, adding "=11" for hr value in some examples

...

  • Partition1: (ds='2008-04-08', hr=11)
  • Partition2: (ds='2008-04-08', hr=12)
  • Partition3: (ds='2008-04-09', hr=11)
  • Partition4: (ds='2008-04-09', hr=12)

and you issue the user issues the following command:

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

then statistics are gathered for partition3 (ds='2008-04-09', hr=11) only.

If the user issues you issue the command:

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

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

If you issue 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 (hr=11 and hr=12).

If the user issues you issue 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.

If you issue the user issues the command:

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

then statistics are gathered for all four partitions.

If the user issues you issue the command:

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

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

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

...

to gather column statistics of the table.

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

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

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

Code Block
DESCRIBE EXTENDED TABLE1;

...

Code Block
 ... , parameters:{numPartitions=4, numFiles=16, numRows=2000, totalSize=16384, ...}, ....

If you issue the user issues the command:

Code Block
DESCRIBE EXTENDED TABLE1 PARTITION(ds='2008-04-09', hr=11);

...

Code Block
 ... , parameters:{numFiles=4, numRows=500, totalSize=4096, ...}, ....

If the user issues you issue the command:

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

...