Run-Time Statistics Category Parameters

This document describes the parameters in the system configuration related to the Run-Time Statistics category.

Note!
To ensure system stability and security, manually modifying these parameters should be done with caution.


ANALYZE Statistics on Database Contents

default_statistics_target


Sets the default statistics target (number of most common values to store) for table columns that do not have a column-specific target set via ALTER TABLE ... SET STATISTICS.

  • Larger values may improve the quality of estimates made by the Postgres query optimizer (planner).
Data Type Default Value Range Setting Classification
int 100 1 ~ 10000 master; session; reload


Query and Index Statistics Collector

These parameters control server-wide statistics collection features. When statistics collection is enabled, the collected data can be accessed through the pg_stat and pg_statio system view families.

track_activities


Enables collection of information about the current command being executed by each session, along with the time when the command began execution.

  • Note: Even when enabled, this information is not visible to all users. Only superusers and the user associated with the session can view it. Therefore, it does not pose a security risk.
Data Type Default Value Setting Classification
boolean on master; session; reload; superuser

track_activity_query_size


Sets the maximum length of query text stored in the current_query column of the system catalog pg_stat_activity.

  • This parameter can only be set at server start.
Data Type Default Value Range Setting Classification
int 1024 100 ~ 102400 segment; system; restart


track_counts


Controls the collection of statistics about database activity.

Data Type Default Value Setting Classification
boolean true master; session; reload; superuser

track_functions


Enables statistics collection on function usage, including number of calls and time spent.

  • Specify pl to track only procedural language functions; specify all to also track SQL and C language functions.
  • Note: SQL functions that are simple enough to be "inlined" into the calling query are not tracked, regardless of this setting.
  • The default value is none, which disables function statistics tracking.
Data Type Default Value Range Setting Classification
enum none none / pl / all master; session; reload

track_io_timing


Enables timing of system I/O calls.

  • This parameter defaults to off because enabling it repeatedly queries the operating system for the current time, which may impose significant overhead on some platforms.
  • You can use the pg_test_timing tool to measure the timing overhead on your system. I/O timing information appears in pg_stat_database, in EXPLAIN output when the BUFFERS option is used, and in pg_stat_statements.
Data Type Default Value Setting Classification
boolean off master; session; reload; superuser

stats_queue_level


Collects resource queue statistics related to database activity.

  • Note: The stats_queue_level server configuration parameter takes effect only when resource management is set to resource queues.
Data Type Default Value Setting Classification
boolean off master; session; reload

stats_temp_directory


Sets the directory for storing temporary statistics data.

  • This parameter can be a path relative to the data directory or an absolute path.
  • Placing this directory on a RAM-based file system can reduce physical I/O and improve performance.
Data Type Default Value Setting Classification
string pg_stat_tmp segments; system; reload; superuser


Statistics Monitoring

log_executor_stats


Writes performance statistics of the query executor to the server log for each query.

  • This is a primitive profiling tool. Cannot be enabled together with log_statement_stats.
Data Type Default Value Setting Classification
boolean off segment; system; restart

log_parser_stats


Writes performance statistics of the query parser to the server log for each query.

  • This is a primitive profiling tool. Cannot be enabled together with log_statement_stats.
Data Type Default Value Setting Classification
boolean off master; session; reload; superuser

log_planner_stats


Writes performance statistics of the Postgres query optimizer (planner) to the server log for each query.

  • This is a primitive profiling tool. Cannot be enabled together with log_statement_stats.
Data Type Default Value Setting Classification
boolean off master; session; reload; superuser

log_statement_stats


Writes overall performance statistics from the query parser, planner, and executor to the server log for each query.

  • This parameter cannot be enabled together with any other per-module statistics options.
Data Type Default Value Setting Classification
boolean off master; session; reload; superuser


Automatic Statistics Collection Parameters

gp_autostats_mode


Specifies the mode for triggering automatic statistics collection using ANALYZE.

  • The on_no_stats option triggers statistics collection on any table without existing statistics after INSERT, UPDATE, or DELETE operations.
  • The on_change option triggers statistics collection only when the number of affected rows exceeds the threshold defined by gp_autostats_on_change_threshold. Operations that can trigger automatic statistics collection include: INSERT, UPDATE, DELETE, CREATE TABLE AS, and COPY.
  • Note: For partitioned tables, automatic statistics collection is not triggered if data is inserted into the top-level parent table. It is triggered only when data is inserted directly into leaf child tables (where data is stored). Statistics are collected only on the leaf tables.
Data Type Default Value Range Setting Classification
enum none none / on_no_stats / on_change master; session; reload

gp_autostats_mode_in_functions


Specifies the mode for triggering automatic statistics collection via ANALYZE statements within procedural language functions.

  • The none option disables statistics collection; the on_no_stats option triggers statistics collection for INSERT, UPDATE, or DELETE operations executed within a function on any table lacking existing statistics.
  • The on_change option triggers statistics collection only when the number of affected rows exceeds the threshold defined by gp_autostats_on_change_threshold. Operations that can trigger automatic statistics collection include: INSERT, UPDATE, DELETE, CREATE TABLE AS, and COPY.
Data Type Default Value Range Setting Classification
enum none none / on_change / on_no_stats master; session; reload

gp_autostats_on_change_threshold


Specifies the threshold for automatic statistics collection when gp_autostats_mode or gp_autostats_mode_in_functions is set to on_change.

  • When a triggering operation affects more than this threshold number of rows, ANALYZE is automatically added and table statistics are collected.
Data Type Default Value Range Setting Classification
int 2147483647 0 ~ INT_MAX master; session; reload

log_autostats


Logs information about automatic ANALYZE operations related to gp_autostats_mode and gp_autostats_mode_in_functions.

Data Type Default Value Setting Classification
boolean off master; session; reload; superuser