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 values stored in the most common values list) 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 reporting 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 limit for query text stored in the current_query column of the system catalog pg_stat_activity.

  • This parameter can only be set at server startup.
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 call counts and execution time.

  • 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 parameter's value.
  • 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 certain 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_io.
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, optimizer, and execution engine 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 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, COPY FROM, and CREATE TABLE AS.
  • The on_eager_change option tracks the number of changed rows in a table within the current transaction. If the number of changed rows exceeds a percentage threshold of the total rows in the table (controlled by gp_autostats_eager_threshold, default 0.1 or 10%), automatic statistics collection is triggered.
  • Note: For partitioned tables, automatic statistics collection is not triggered if data is inserted through the top-level parent table. It is triggered only when data is inserted directly into leaf child tables (where data is physically stored). Statistics are collected only on leaf tables.
Data Type Default Value Range Setting Classification
enum none none / on_no_stats / on_change / on_eager_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 functions on tables that lack 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, COPY FROM, and CREATE TABLE AS.
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 is set to on_change.

  • When a table operation affects more rows than this threshold, an ANALYZE is scheduled and 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