ANALYZE | ANALYSE

Function

Collects statistics about table contents in databases, and stores the results in the PG_STATISTIC system catalog. The execution plan generator uses these statistics to determine which one is the most effective execution plan.

If no parameters are specified, ANALYZE analyzes each table and partitioned table in the database. You can also specify table_name, column, and partition_name to limit the analysis to a specified table, column, or partitioned table.

Users who can execute ANALYZE on a specific table include the owner of the table, owner of the database where the table is, users with the ANALYZE permission on the table, users who are granted the gs_role_analyze_any role, and users with the SYSADMIN attribute.

To collect statistics using percentage sampling, you must have the ANALYZE and SELECT permissions.

ANALYZE and ANALYSE VERIFY are used to check whether data files of common tables (row-store and column-store tables) in a database are damaged. Currently, this function does not support HDFS tables.

Precautions

Syntax

1
{ANALYZE | ANALYSE} VERIFY {FAST|COMPLETE} table_name PARTITION {(partition_name)}[CASCADE];
  • You can detect a single partition of a table, but cannot perform the CASCADE operation on index tables.
  • HDFS tables (internal and foreign tables), temporary tables, and unlog tables are not supported.

Parameter Description

Examples