ANALYZE_STATISTICS is an alias of the function
ANALYZE_HISTOGRAM, which is no longer documented.
Collects and aggregates data samples and storage information from all nodes that store projections associated with the specified table. By default, Vertica analyzes multiple columns in a single-query execution plan, depending on resource limits. Such multi-column analysis facilitates the following objectives:
- Reduce plan execution latency.
- Speed up analysis of relatively small tables with many columns.
Vertica writes statistics to the database catalog. The query optimizer uses this collected data to create query plans. Without this data, the query optimizer assumes uniform distribution of data values and equal storage usage for all projections.
You can cancel statistics collection with CTRL+C or by calling
ANALYZE_STATISTICS ('[[[database.]schema.]table]' [, 'column‑list' [, percent ]] )
If an error occurs, refer to
vertica.log for details.
Database and schema. The default schema is
Table on which to collect data. If set to an empty string, Vertica collects statistics for all database tables and their projections.
Comma-delimited list of columns in table, typically predicate columns. Vertica narrows the scope of the data collection to the specified columns.
If you alter a table to add a column and populate its contents with either default or other values, call
A float value between 0 and 100 that specifies what percentage of data to read from disk (not the amount of data to analyze). If you omit this argument, Vertica sets the percentage to 10.
Analyzing more than 10 percent disk space takes proportionally longer to process, but produces a higher level of sampling accuracy.
- Schema: USAGE
- Table: One of INSERT, DELETE, or UPDATE
- Vertica supports
ANALYZE_STATISTICSon local and global temporary tables. In both cases, you can obtain statistics only on tables that are created with the option
ON COMMIT PRESERVE ROWS. Otherwise, Vertica deletes table content on committing the current transaction, so no table data is available for analysis.
- Vertica collects no statistics from the following projections:
- Live aggregate and Top-K projections
- Projections that are defined to include an SQL function within an expression
- Vertica collects no statistics on columns of ARRAY or SET types.