HomeMogDBMogDB StackUqbar
v2.1

Documentation:v2.1

Supported Versions:

Other Versions:

Query and Index Statistics Collector

The query and index statistics collector is used to collect statistics during database running. The statistics include the times of inserting and updating a table and index, the number of disk blocks and tuples, and the time required for the last cleanup and analysis on each table. The statistics can be viewed by querying system view families pg_stats and pg_statistic. The following parameters are used to set the statistics collection feature in the server scope.

track_activities

Parameter description: Collects statistics about the commands that are being executed in session.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the statistics collection function is enabled.
  • off indicates that the statistics collection function is disabled.

Default value: on

track_counts

Parameter description: Collects statistics about database activities.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the statistics collection function is enabled.
  • off indicates that the statistics collection function is disabled.

img NOTE:

When the database to be cleaned up is selected from the AutoVacuum automatic cleanup process, the database statistics are required. In this case, the default value is set to on.

Default value: on

track_io_timing

Parameter description: Collects statistics about I/O timing in the database. The I/O timing statistics can be queried by using the pg_stat_database parameter.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • If this parameter is set to on, the collection function is enabled. In this case, the collector repeatedly queries the operating system at the current time. As a result, large number of costs may occur on some platforms. Therefore, the default value is set to off.
  • off indicates that the statistics collection function is disabled.

Default value: off

track_functions

Parameter description: Collects statistics of the number and duration of function invocations.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE:

When the SQL functions are set to inline functions queried by the invoking, these SQL functions cannot be traced no matter these functions are set or not.

Value range: enumerated values

  • pl indicates that only procedural language functions are traced.
  • all indicates that SQL language functions area traced.
  • none indicates that the function tracing function is disabled.

Default value: none

track_activity_query_size

Parameter description: Specifies byte counts of the current running commands used to trace each active session.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: an integer ranging from 100 to 102400

Default value: 1024

stats_temp_directory

Parameter description: Specifies the directory for saving temporary statistics.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE:

If a RAM-based file system directory is used, the actual I/O cost can be lowered and the performance can be improved.

Value range: a string

Default value: pg_stat_tmp

track_thread_wait_status_interval

Parameter description: Specifies the interval of collecting the thread status information.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: 0 to 1 day. The unit is min.

Default value: 30min

enable_save_datachanged_timestamp

Parameter description: Specifies whether to record the time when INSERT, UPDATE, DELETE, or EXCHANGE/TRUNCATE/DROP PARTITION is performed on table data.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the time when an operation is performed on table data will be recorded.
  • off indicates that the time when an operation is performed on table data will not be recorded.

Default value: on

track_sql_count

Parameter description: Collects statistics about the statements (SELECT, INSERT, UPDATE, MERGE INTO, and DELETE) that are being executed in a session.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the statistics collection function is enabled.
  • off indicates that the auditing function is disabled.

Default value: on

img NOTE:

  • The track_sql_count parameter is restricted by the track_activities parameter when the gs_sql_count or pgxc_sql_count view is queried.
  • If track_activities is set to on and track_sql_count is set to off, a warning message indicating that track_sql_count is disabled will be displayed in logs when the gs_sql_countview is queried.
  • If both track_activities and track_sql_count are set to off, two warning messages indicating that track_activities is disabled and track_sql_count is disabled will be displayed in logs when the views are queried.
  • If track_activities is set to off and track_sql_count is set to on, a warning message indicating that track_activities is disabled will be displayed in logs when the views are queried.
  • If track_sql_count is set to off, querying the gs_sql_count or pgxc_sql_count view returns 0.
Copyright © 2011-2024 www.enmotech.com All rights reserved.