Running statistics (RUN-TIME STATISTICS) category parameters

This document describes the relevant parameters for the running statistical information category in the system configuration parameters.

Notes!
To ensure the stability and security of the system, please be sure to manually modify the relevant parameters**.


ANALYZE Statistics on database content

default_statistics_target


Sets the default statistical sample target (number of values ​​stored in the public value list) for table columns that do not set a specific column target through ALTER TABLE SET STATISTICS.

  • Larger values ​​may improve the quality of the Postgres query optimizer (planner) estimates.

| Data Type | Default Value | Value Range | Set Classification | | --- | --- | --- | | int | 100 | 1 ~ 10000 | master; session; reload |


Query and Index Statistics Collector

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

track_activities


Enables information collection for the current execution command for each session, and also the time when the command starts execution.

  • Note: Even if this parameter is enabled, this information is not visible to all users, only superusers and users with sessions that have reported information, so it does not manifest as a security risk.

| Data Type | Default Value | Settings Category | | --- | --- | | 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 pg_stat_activity system directory.

  • This parameter can only be set when the server starts.

| Data Type | Default Value | Value Range | Set Classification | | --- | --- | --- | | int | 1024 | 100 ~ 102400 | segment; system; restart |


track_counts


Controls statistics on the collection of database activity.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | true | master; session; reload; superuser |

track_functions


Enable statistics on counting and when used.

  • Specify pl to track only procedural language functions; specify all to track SQL and C language functions.
  • Note: No SQL language functions that are simple enough to be "inlined" into the call query will not be tracked regardless of the value of this parameter.
  • The default value is none, which disables function statistics tracking.

| Data Type | Default Value | Value Range | Set Classification | | --- | --- | --- | | enum | none | none / pl / all | master; session; reload |

track_io_timing


Enable timing of system I/O calls.

  • This parameter value defaults to off, because when it is turned on again, it will repeatedly query the operating system for the current time, which will put significant load on some platforms.
  • You can use the pg_test_timing tool to measure the overhead of timing in your system. I/O timing information is displayed in pg_stat_database, in EXPLAIN output when the BUFFERS option is used, and in pg_stat_statements.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | off | master; session; reload; superuser |

stats_queue_level


Collect resource queue statistics about database activity.

  • Note: The stats_queue_level server configuration parameter will take effect only when resource management is set to resource queue.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | off | master; session; reload |

stats_temp_directory


Set up the directory where temporary statistics are stored.

  • This parameter is a path relative to the data directory or an absolute path.
  • Specifying this parameter on a RAM-based file system will reduce physical I/O requirements and improve performance.

| Data Type | Default Value | Settings Category | | --- | --- | | string | pa_stat_tmp | segments; system; reload; superuser |


Statistical monitoring

log_executor_stats


For each query, performance statistics of the query execution program are written to the server log.

  • This is an original analysis tool. Cannot be enabled with log_statement_stats.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | off | segment; system; restart |

log_parser_stats


For each query, the performance statistics of the query parser are written to the server log.

  • This is an original analysis tool. Cannot be enabled with log_statement_stats.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | off | master; session; reload; superuser |

log_planner_stats


For each query, the performance statistics of the Postgres query optimizer (planner) are written to the server log.

  • This is an original analysis tool. Cannot be enabled with log_statement_stats.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | off | master; session; reload; superuser |

log_statement_stats


For each query, the overall performance statistics of the query parser, optimizer, and execution engine are written to the server log.

  • This parameter cannot be enabled with any other options for each module statistics.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | off | master; session; reload; superuser |


Automatic statistics collection parameters

gp_autostats_mode


Specifies the mode to trigger automatic statistics collection using ANALYZE.

  • The on_no_stats option can trigger statistics collection for CREATE TABLE AS SELECT, INSERT, or COPY operations on any table without statistics.
  • The on_change option triggers statistics collection when the number of affected rows exceeds the threshold defined by gp_autostats_on_change_threshold. Operations that can use on_change to trigger automatic statistics collection include: CREATE TABLE AS SELECT, UPDATE, DELETE, INSERT, and COPY.
  • Note: For partitioned tables, automatic statistics collection will not be triggered if data is inserted from the top-level parent table of the partitioned table. If the data is inserted directly into the leaf table of the partition table (the data is stored), automatic statistics collection is triggered. Statistics are collected only on the leaf table.

| Data Type | Default Value | Value Range | Set Classification | | --- | --- | --- | | enum | none | none / on_no_stats / on_change | master; session; reload |

gp_autostats_mode_in_functions


Specifies the mode to trigger automatic statistics collection using the ANALYZE statement in the procedural language function.- The none option disables statistics collection; the on_no_stats option CREATE TABLE AS SELECT, INSERT, or COPY operation that triggers statistics collection by performing in any function without existing statistics tables.

  • The on_change option triggers statistics collection only if the number of affected rows exceeds the threshold defined by gp_autostats_on_change_threshold. The operations that can use on_change to trigger the automatic information statistics collection function include: CREATE TABLE AS SELECT, UPDATE, DELETE, INSERT, and COPY. | Data Type | Default Value | Value Range | Set Classification | | --- | --- | | enum | none | none / on_change / on_no_stats | master; session; reload |

gp_autostats_on_change_threshold


When gp_autostats_mode is set to on_change, the threshold value for automatic statistics collection is specified.

  • When the trigger table operation affects the number of rows exceeding this threshold, ANALYZE is added and the table statistics are collected.

| Data Type | Default Value | Value Range | Set Classification | | --- | --- | | int | 2147483647 | 0 ~ INT_MAX | master; session; reload |

log_autostats


Record information about the automatic ANALYZE operation related to gp_autostats_mode and gp_autostats_on_change_threshold.

| Data Type | Default Value | Settings Category | | --- | --- | | boolean | off | master; session; reload; superuser |