|
- datid
+ datid>
oid>
- The OID of the database
+ OID of a database
|
- datname
+ datname>
name>
- The name of the database
+ Name of this database
|
- numbackends
+ numbackends>
integer>
- The number of backends currently connected to this database.
- This is the only column in this view that returns a value for the
- current state, all other columns return the accumulated values since
+ Number of backends currently connected to this database.
+ This is the only column in this view that returns a value reflecting
+ current state; all other columns return the accumulated values since
the last reset. This value can also be returned by directly calling
the pg_stat_get_db_numbackends function.
|
- xact_commit
+ xact_commit>
bigint>
- The number of transactions in this database that have been
+ Number of transactions in this database that have been
committed. This value can also be returned by directly calling
the pg_stat_get_db_xact_commit function.
|
- xact_rollback
+ xact_rollback>
bigint>
- The number of transactions in this database that have been
+ Number of transactions in this database that have been
rolled back. This value can also be returned by directly calling
the pg_stat_get_db_xact_rollback function.
|
- blks_read
+ blks_read>
bigint>
- The number of disk blocks read in this database.
+ Number of disk blocks read in this database.
This value can also be returned by directly calling
the pg_stat_get_db_blocks_fetched and
pg_stat_get_db_blocks_hit functions and
subtracting the results.
|
- blks_hits
+ blks_hit>
bigint>
- The number of disk blocks read from the buffer cache
- (this only includes hits in the PostgreSQL buffer cache, and not
- the operating system filesystem cache).
+ Number of times disk blocks were found already in the buffer
+ cache, so that a read was not necessary (this only includes hits in the
+ PostgreSQL buffer cache, not the operating system's filesystem cache).
This value can also be returned by directly calling
the pg_stat_get_db_blocks_hit function.
|
- tup_returned
+ tup_returned>
bigint>
- The number of rows returned by queries in this database.
+ Number of rows returned by queries in this database.
This value can also be returned by directly calling
the pg_stat_get_db_tuples_returned function.
|
- tup_fetched
+ tup_fetched>
bigint>
- The number of rows fetched by queries in this database.
+ Number of rows fetched by queries in this database.
This value can also be returned by directly calling
the pg_stat_get_db_tuples_fetched function.
|
- tup_inserted
+ tup_inserted>
bigint>
- The number of rows inserted by queries in this database.
+ Number of rows inserted by queries in this database.
This value can also be returned by directly calling
the pg_stat_get_db_tuples_inserted function.
|
- tup_updated
+ tup_updated>
bigint>
- The number of rows updated by queries in this database.
+ Number of rows updated by queries in this database.
This value can also be returned by directly calling
the pg_stat_get_db_tuples_updated function.
|
- tup_deleted
+ tup_deleted>
bigint>
- The number of rows deleted by queries in this database.
+ Number of rows deleted by queries in this database.
This value can also be returned by directly calling
the pg_stat_get_db_tuples_deleted function.
|
- conflicts
+ conflicts>
bigint>
-
- The number of queries canceled due to conflict with recovery
- (on standby servers) in this database. (See
- for more details).
+ Number of queries canceled due to conflicts with recovery
+ in this database. (Conflicts occur only on standby servers; see
+ for details.)
This value can also be returned by directly calling
the pg_stat_get_db_conflict_all function.
|
- temp_files
+ temp_files>
bigint>
-
- The number of temporary files written by queries in the database.
+ Number of temporary files created by queries in this database.
All temporary files are counted, regardless of why the temporary file
- was created (sorting or hash) or file size, and regardless of the
+ was created (e.g., sorting or hash), and regardless of the
setting.
This value can also be returned by directly calling
the pg_stat_get_db_temp_files function.
|
- temp_bytes
+ temp_bytes>
bigint>
-
- The amount of data written to temporary files by queries in
- the database. All temporary files are counted, regardless of why
- the temporary file was created (sorting or hash) or file size, and
+ Total amount of data written to temporary files by queries in
+ this database. All temporary files are counted, regardless of why
+ the temporary file was created, and
regardless of the setting.
This value can also be returned by directly calling
the pg_stat_get_db_temp_bytes function.
|
- deadlocks
+ deadlocks>
bigint>
- Number of deadlocks detected in the database.
+ Number of deadlocks detected in this database.
This value can also be returned by directly calling
the pg_stat_get_db_deadlocks function.
|
- block_read_time
+ block_read_time>
bigint>
- Time spent by backends reading data file blocks, in milliseconds.
+ Time spent reading data file blocks by backends in this database,
+ in milliseconds.
The same value can be returned in microseconds by directly calling
the pg_stat_get_db_block_time_read function.
|
- block_write_time
+ block_write_time>
bigint>
- Time spent by backends writing data file blocks, in milliseconds.
+ Time spent writing data file blocks by backends in this database,
+ in milliseconds.
The same value can be returned in microseconds by directly calling
the pg_stat_get_db_block_time_write function.
|
- stats_reset
- timestamptz>
- The last time the statistics were reset.
+ stats_reset>
+ timestamp with time zone>
+ Time at which these statistics were last reset.
This value can also be returned by directly calling
the pg_stat_get_reset_time function.
The pg_stat_database view will contain one row
- for each database in the cluster showing database-wide statistics.
-
-
-
-
pg_stat_database_conflicts view
-
-
- |
- Column
- Type
- Description
-
-
-
-
- |
- datid
- oid>
- The OID of the database
-
- |
- datname
- name>
- The name of the database
-
- |
- confl_tablespace
- bigint>
- The number of queries that have been canceled due to
- dropped tablespaces. This value can also be returned by directly calling
- the pg_stat_get_db_conflict_tablespace function.
-
- |
- confl_lock
- bigint>
- The number of queries that have been canceled due to
- lock timeouts. This value can also be returned by directly calling
- the pg_stat_get_db_conflict_lock function.
-
- |
- confl_snapshot
- bigint>
- The number of queries that have been canceled due to
- old snapshots. This value can also be returned by directly calling
- the pg_stat_get_db_conflict_snapshot function.
-
- |
- confl_bufferpin
- bigint>
- The number of queries that have been canceled due to
- pinned buffers. This value can also be returned by directly calling
- the pg_stat_get_db_conflict_bufferpin function.
-
- |
- confl_deadlock
- bigint>
- The number of queries that have been canceled due to
- deadlocks. This value can also be returned by directly calling
- the pg_stat_get_db_conflict_startup_deadlock
- function.
-
-
-
-
-
- The pg_stat_database_conflicts view will contain
- one row per database showing database-wide statistics about
- query cancels due to conflict with recovery on standby servers.
- Will only contain information on standby servers, since
- conflicts do not occur on master servers.
-
-
-
-
pg_stat_replication view
-
-
- |
- Column
- Type
- Description
-
-
-
-
- |
- pid
- integer>
- The process id of the WAL sender process
-
- |
- usesysid
- oid>
- The OID of the user logged into this WAL sender process
-
- |
- usename
- name>
- The name of the user logged into this WAL sender process
-
- |
- application_name
- text>
- The name of the application that has initiated the connection
- to the WAL sender.
-
- |
- client_addr
- inet>
- The remote IP of the client connected to the WAL sender.
- If this field is not set, it indicates that the client is
- connected via a Unix socket on the server machine.
-
-
- |
- client_hostname
- text>
-
- If available, the hostname of the client as reported by a
- reverse lookup of client_addr>. This field will
- only be set when is enabled.
-
-
- |
- client_port
- integer>
-
- The remote TCP port that the client is using for communication
- to the, or NULL> if a unix socket is used.
-
-
- |
- backend_start
- timestamp with time zone>
-
- The time when this process was started, i.e. when the
- client connected to the WAL sender.
-
-
- |
- state
- text>
- Current WAL sender state
-
- |
- sent_location
- text>
- Last transaction log position sent on this connection
-
- |
- write_location
- text>
- Last transaction log position written to disk by the slave
-
- |
- flush_location
- text>
- Last transaction log position flushed to disk by the slave
-
- |
- replay_location
- text>
- Last transaction log position replayed into the database on the slave
-
- |
- sync_priority
- int>
-
- The priority in the order which this slave will be picked as
- the synchronous standby.
-
-
- |
- sync_state
- text>
-
- The synchronous state of this slave.
-
-
-
-
-
-
- The pg_stat_replication view will contain one row
- per WAL sender process, showing statistics about the replication to this
- slave. Only directly connected standbys are listed; no information about
- downstream standby servers is recorded.
+ for each database in the cluster, showing database-wide statistics.
|
- relid
+ relid>
oid>
- The OID of the table
+ OID of a table
|
- schemaname
+ schemaname>
name>
- The name of the schema that the table is in
+ Name of the schema that this table is in
|
- relname
+ relname>
name>
- The name of the table
+ Name of this table
|
- seq_scan
+ seq_scan>
bigint>
- The number of sequential scans initiated on this table.
+ Number of sequential scans initiated on this table.
This value can also be returned by directly calling
the pg_stat_get_numscans function.
|
- seq_tup_read
+ seq_tup_read>
bigint>
- The number of live rows fetch by sequential scans.
+ Number of live rows fetched by sequential scans.
This value can also be returned by directly calling
the pg_stat_get_tuples_returned function.
|
- idx_scan
+ idx_scan>
bigint>
- The number of index scans initiated on this table
+ Number of index scans initiated on this table
|
- idx_tup_fetch
+ idx_tup_fetch>
bigint>
- The number of live rows fetch by index scans.
+ Number of live rows fetched by index scans
|
- n_tup_ins
+ n_tup_ins>
bigint>
- The number of rows inserted.
+ Number of rows inserted.
This value can also be returned by directly calling
the pg_stat_get_tuples_inserted function.
|
- n_tup_upd
+ n_tup_upd>
bigint>
- The number of rows updated.
+ Number of rows updated.
This value can also be returned by directly calling
the pg_stat_get_tuples_updated function.
|
- n_tup_del
+ n_tup_del>
bigint>
- The number of rows deleted.
+ Number of rows deleted.
This value can also be returned by directly calling
the pg_stat_get_tuples_deleted function.
|
- n_tup_hot_upd
+ n_tup_hot_upd>
bigint>
- The number of rows HOT (i.e., no separate index update) updated.
+ Number of rows HOT updated (i.e., with no separate index
+ update required).
This value can also be returned by directly calling
the pg_stat_get_tuples_hot_updated function.
|
- n_live_tup
+ n_live_tup>
bigint>
- The number of live rows.
+ Estimated number of live rows.
This value can also be returned by directly calling
the pg_stat_get_live_tuples function.
|
- n_dead_tup
+ n_dead_tup>
bigint>
- The number of dead rows.
+ Estimated number of dead rows.
This value can also be returned by directly calling
the pg_stat_get_dead_tuples function.
|
- last_vacuum
+ last_vacuum>
timestamp with time zone>
- The last time the table was manually non-
+ Last time at which this table was manually vacuumed
+ (not counting VACUUM FULL>).
This value can also be returned by directly calling
the pg_stat_get_last_vacuum_time function.
|
- last_autovacuum
+ last_autovacuum>
timestamp with time zone>
- The last time the table was vacuumed by the autovacuum daemon.
+ Last time at which this table was vacuumed by the autovacuum
+ daemon.
This value can also be returned by directly calling
the pg_stat_get_last_autovacuum_time function.
|
- last_analyze
+ last_analyze>
timestamp with time zone>
- The last time the table was manually analyzed.
+ Last time at which this table was manually analyzed.
This value can also be returned by directly calling
the pg_stat_get_last_analyze_time function.
|
- last_autoanalyze
+ last_autoanalyze>
timestamp with time zone>
- The last time the table was analyzed by the autovacuum daemon.
+ Last time at which this table was analyzed by the autovacuum
+ daemon.
This value can also be returned by directly calling
the pg_stat_get_last_autoanalyze_time function.
|
- vacuum_count
+ vacuum_count>
bigint>
- The number of times this table has been manually non-
- This value can also be returned by directly calling
- the pg_stat_get_vacuum_count function.
+ Number of times this table has been manually vacuumed
+ (not counting VACUUM FULL>)
|
- autovacuum_count
+ autovacuum_count>
bigint>
- The number of times this table has been vacuumed by the autovacuum daemon.
+ Number of times this table has been vacuumed by the autovacuum
+ daemon.
This value can also be returned by directly calling
the pg_stat_get_autovacuum_count function.
|
- analyze_count
+ analyze_count>
bigint>
- The number of times this table has been manually analyzed.
+ Number of times this table has been manually analyzed.
This value can also be returned by directly calling
the pg_stat_get_analyze_count function.
|
- autoanalyze_count
+ autoanalyze_count>
bigint>
- The number of times this table has been analyzed by the autovacuum daemon.
+ Number of times this table has been analyzed by the autovacuum
+ daemon.
This value can also be returned by directly calling
the pg_stat_get_autoanalyze_count function.
The pg_stat_all_tables view will contain
one row for each table in the current database (including TOAST
- tables) with information about accesses to this specific table. The
+ tables), showing statistics about accesses to that specific table. The
pg_stat_user_tables and
- pg_stat_sys_tables contain the same information,
- but filtered to only have rows for user and system tables.
+ pg_stat_sys_tables views
+ contain the same information,
+ but filtered to only show user and system tables respectively.
|
- relid
+ relid>
oid>
- The OID of the table for this index
+ OID of the table for this index
|
- indexrelid
+ indexrelid>
oid>
- The OID of the index
+ OID of this index
|
- schemaname
+ schemaname>
name>
- The name of the schema the index is in
+ Name of the schema this index is in
|
- relname
+ relname>
name>
- The name of the table for this index
+ Name of the table for this index
|
- indexrelname
+ indexrelname>
name>
- The name of the index
+ Name of this index
|
- idx_scan
+ idx_scan>
bigint>
Number of index scans initiated on this index.
This value can also be returned by directly calling
the pg_stat_get_numscans function.
|
- idx_tup_read
+ idx_tup_read>
bigint>
Number of index entries returned by scans on this index.
This value can also be returned by directly calling
the pg_stat_get_tuples_returned function.
|
- idx_tup_fetch
+ idx_tup_fetch>
bigint>
- Number of live table rows fetched by simple index scans using this index.
+ Number of live table rows fetched by simple index scans using this
+ index.
This value can also be returned by directly calling
the pg_stat_get_tuples_fetched function.
The pg_stat_all_indexes view will contain
- one row for each index in the current database
- with information about accesses to this specific index. The
+ one row for each index in the current database,
+ showing statistics about accesses to that specific index. The
pg_stat_user_indexes and
- pg_stat_sys_indexes contain the same information,
- but filtered to only have rows for user and system indexes.
+ pg_stat_sys_indexes views
+ contain the same information,
+ but filtered to only show user and system indexes respectively.
+ Indexes can be used via either simple index scans or bitmap>
+ index scans. In a bitmap scan
+ the output of several indexes can be combined via AND or OR rules,
+ so it is difficult to associate individual heap row fetches
+ with specific indexes when a bitmap scan is used. Therefore, a bitmap
+ scan increments the
+ pg_stat_all_indexes>.idx_tup_read>
+ count(s) for the index(es) it uses, and it increments the
+ pg_stat_all_tables>.idx_tup_fetch>
+ count for the table, but it does not affect
+ pg_stat_all_indexes>.idx_tup_fetch>.
+
+
+
+ The idx_tup_read> and idx_tup_fetch> counts
+ can be different even without any use of bitmap scans,
+ because idx_tup_read> counts
+ index entries retrieved from the index while idx_tup_fetch>
+ counts live rows fetched from the table. The latter will be less if any
+ dead or not-yet-committed rows are fetched using the index, or if any
+ heap fetches are avoided by means of an index-only scan.
+
+
+
pg_statio_all_tables view
|
- relid
+ relid>
oid>
- The OID of the table
+ OID of a table
|
- schemaname
+ schemaname>
name>
- The name of the schema that the table is in
+ Name of the schema that this table is in
|
- relname
+ relname>
name>
- The name of the table
+ Name of this table
|
- heap_blks_read
- name>
+ heap_blks_read>
+ bigint>
Number of disk blocks read from this table.
This value can also be returned by directly calling
the pg_stat_get_blocks_fetched and
subtracting the results.
|
- heap_blks_hit
- name>
+ heap_blks_hit>
+ bigint>
Number of buffer hits in this table.
This value can also be returned by directly calling
the pg_stat_get_blocks_hit function.
|
- idx_blks_read
- name>
+ idx_blks_read>
+ bigint>
Number of disk blocks read from all indexes on this table
|
- idx_blks_hit
- name>
- Number of buffer hits in all indexes of this table.
+ idx_blks_hit>
+ bigint>
+ Number of buffer hits in all indexes of this table
|
- toast_blks_read
- name>
+ toast_blks_read>
+ bigint>
Number of disk blocks read from this table's TOAST table (if any)
|
- toast_blks_hit
- name>
+ toast_blks_hit>
+ bigint>
Number of buffer hits in this table's TOAST table (if any)
|
- tidx_blks_read
- name>
+ tidx_blks_read>
+ bigint>
Number of disk blocks read from this table's TOAST table index (if any)
|
- tidx_blks_hit
- name>
+ tidx_blks_hit>
+ bigint>
Number of buffer hits in this table's TOAST table index (if any)
The pg_statio_all_tables view will contain
one row for each table in the current database (including TOAST
- tables) with information about I/O on this specific table. The
+ tables), showing statistics about I/O on that specific table. The
pg_statio_user_tables and
- pg_statio_sys_tables contain the same information,
- but filtered to only have rows for user and system tables.
+ pg_statio_sys_tables views
+ contain the same information,
+ but filtered to only show user and system tables respectively.
|
- relid
+ relid>
oid>
- The OID of the table for this index
+ OID of the table for this index
|
- indexrelid
+ indexrelid>
oid>
- The OID of the index
+ OID of this index
|
- schemaname
+ schemaname>
name>
- The name of the schema the index is in
+ Name of the schema this index is in
|
- relname
+ relname>
name>
- The name of the table for this index
+ Name of the table for this index
|
- indexrelname
+ indexrelname>
name>
- The name of the index
+ Name of this index
|
- idx_blks_read
- name>
- Number of disk blocks read from the index.
+ idx_blks_read>
+ bigint>
+ Number of disk blocks read from this index.
This value can also be returned by directly calling
the pg_stat_get_blocks_fetched and
pg_stat_get_blocks_hit functions and
subtracting the results.
|
- idx_blks_hit
- name>
- Number of buffer hits in the index.
+ idx_blks_hit>
+ bigint>
+ Number of buffer hits in this index.
This value can also be returned by directly calling
the pg_stat_get_blocks_hit function.
The pg_statio_all_indexes view will contain
- one row for each index in the current database
- with information about I/O on this specific index. The
+ one row for each index in the current database,
+ showing statistics about I/O on that specific index. The
pg_statio_user_indexes and
- pg_statio_sys_indexes contain the same information,
- but filtered to only have rows for user and system indexes.
+ pg_statio_sys_indexes views
+ contain the same information,
+ but filtered to only show user and system indexes respectively.
|
- relid
+ relid>
oid>
- The OID of the sequence
+ OID of a sequence
|
- schemaname
+ schemaname>
name>
- The name of the schema the sequence is in
+ Name of the schema this sequence is in
|
- relname
+ relname>
name>
- The name of the sequence
+ Name of this sequence
|
- blks_read
- name>
- Number of disk blocks read from the sequence
+ blks_read>
+ bigint>
+ Number of disk blocks read from this sequence
|
- blks_hit
- name>
- Number of buffer hits in the sequence
+ blks_hit>
+ bigint>
+ Number of buffer hits in this sequence
- The pg_statio_all_indexes view will contain
- one row for each sequence in the current database
- with information about I/O on this specific sequence.
+ The pg_statio_all_sequences view will contain
+ one row for each sequence in the current database,
+ showing statistics about I/O on that specific sequence.
|
- funcid
+ funcid>
oid>
- The OID of the function
+ OID of a function
|
- schemaname
+ schemaname>
name>
- The name of the schema the function is in
+ Name of the schema this function is in
|
- funcname
+ funcname>
name>
- The name of the function
+ Name of this function
|
- calls
+ calls>
bigint>
- Number of times the function has been called.
+ Number of times this function has been called.
This value can also be returned by directly calling
the pg_stat_get_function_calls function.
|
- total_time
+ total_time>
bigint>
- Total time spent in this functions and all other functions
+ Total time spent in this function and all other functions
called by it, in milliseconds.
The same value can be returned in microseconds by directly calling
the pg_stat_get_function_time function.
|
- self_time
+ self_time>
bigint>
- Total time spent in this functions itself but not including
+ Total time spent in this function itself, not including
other functions called by it, in milliseconds.
The same value can be returned in microseconds by directly calling
the pg_stat_get_function_self_time function.
The pg_stat_user_functions view will contain
- one row for each tracked function (as specified by the
- parameter).
+ one row for each tracked function, showing statistics about executions of
+ that function. The parameter
+ controls exactly which functions are tracked.
+
+
+
+
pg_stat_replication view
+
+
+ |
+ Column
+ Type
+ Description
+
+
+
+
+ |
+ pid>
+ integer>
+ Process ID of a WAL sender process
+
+ |
+ usesysid>
+ oid>
+ OID of the user logged into this WAL sender process
+
+ |
+ usename>
+ name>
+ Name of the user logged into this WAL sender process
+
+ |
+ application_name>
+ text>
+ Name of the application that is connected
+ to this WAL sender
+
+ |
+ client_addr>
+ inet>
+ IP address of the client connected to this WAL sender.
+ If this field is not set, it indicates that the client is
+ connected via a Unix socket on the server machine.
+
+
+ |
+ client_hostname>
+ text>
+ Host name of the connected client, as reported by a
+ reverse DNS lookup of client_addr>. This field will
+ only be set for IP connections, and only when
+ linkend="guc-log-hostname"> is enabled.
+
+
+ |
+ client_port>
+ integer>
+ TCP port number that the client is using for communication
+ with this WAL sender, or NULL> if a Unix socket is used
+
+
+ |
+ backend_start>
+ timestamp with time zone>
+ Time when this process was started, i.e., when the
+ client connected to this WAL sender
+
+
+ |
+ state>
+ text>
+ Current WAL sender state
+
+ |
+ sent_location>
+ text>
+ Last transaction log position sent on this connection
+
+ |
+ write_location>
+ text>
+ Last transaction log position written to disk by this standby
+ server
+
+ |
+ flush_location>
+ text>
+ Last transaction log position flushed to disk by this standby
+ server
+
+ |
+ replay_location>
+ text>
+ Last transaction log position replayed into the database on this
+ standby server
+
+ |
+ sync_priority>
+ integer>
+ Priority of this standby server for being chosen as the
+ synchronous standby
+
+ |
+ sync_state>
+ text>
+ Synchronous state of this standby server
+
+
+
+
+
+ The pg_stat_replication view will contain one row
+ per WAL sender process, showing statistics about replication to that
+ sender's connected standby server. Only directly connected standbys are
+ listed; no information is available about downstream standby servers.
+
+
+
+
pg_stat_database_conflicts view
+
+
+ |
+ Column
+ Type
+ Description
+
+
+
+
+ |
+ datid>
+ oid>
+ OID of a database
+
+ |
+ datname>
+ name>
+ Name of this database
+
+ |
+ confl_tablespace>
+ bigint>
+ Number of queries in this database that have been canceled due to
+ dropped tablespaces. This value can also be returned by directly calling
+ the pg_stat_get_db_conflict_tablespace function.
+
+ |
+ confl_lock>
+ bigint>
+ Number of queries in this database that have been canceled due to
+ lock timeouts. This value can also be returned by directly calling
+ the pg_stat_get_db_conflict_lock function.
+
+ |
+ confl_snapshot>
+ bigint>
+ Number of queries in this database that have been canceled due to
+ old snapshots. This value can also be returned by directly calling
+ the pg_stat_get_db_conflict_snapshot function.
+
+ |
+ confl_bufferpin>
+ bigint>
+ Number of queries in this database that have been canceled due to
+ pinned buffers. This value can also be returned by directly calling
+ the pg_stat_get_db_conflict_bufferpin function.
+
+ |
+ confl_deadlock>
+ bigint>
+ Number of queries in this database that have been canceled due to
+ deadlocks. This value can also be returned by directly calling
+ the pg_stat_get_db_conflict_startup_deadlock
+ function.
+
+
+
+
+
+ The pg_stat_database_conflicts view will contain
+ one row per database, showing database-wide statistics about
+ query cancels occurring due to conflicts with recovery on standby servers.
+ This view will only contain information on standby servers, since
+ conflicts do not occur on master servers.
-
-
Other Statistics Functions
+
+
+
Statistics Functions
+
+ Other ways of looking at the statistics can be set up by writing
+ queries that use the same underlying statistics access functions as
+ the standard views do. The per-database access
+ functions take a database OID as an argument to identify which
+ database to report on. The per-table and per-index functions take
+ a table or index OID. The functions for function-call statistics
+ take a function OID. (Note that only tables, indexes, and functions
+ in the current database can be seen with these functions.) The
+ per-server-process access functions take a server process
+ number, which ranges from one to the number of currently active
+ server processes.
+
+
+ Additional functions related to statistics collection are listed in
+ linkend="monitoring-stats-funcs-table">.
+
Other Statistics Functions
pg_backend_pid()
integer
- Process ID of the server process attached to the current session
+ Process ID of the server process handling the current session
-
|
pg_stat_get_wal_senders()
setof record
- One record for each active wal sender. The fields returned are a subset
+ One record for each active WAL sender. The fields returned are a subset
of those in the pg_stat_replication view.
pg_stat_reset_shared(text)
void
- Reset some of the shared statistics counters for the database cluster to
- zero (requires superuser privileges). Calling
- pg_stat_reset_shared('bgwriter')> will zero all the values shown by
- pg_stat_bgwriter>.
+ Reset some cluster-wide statistics counters to zero, depending on the
+ argument (requires superuser privileges).
+ Calling pg_stat_reset_shared('bgwriter')> will zero all the
+ counters shown in the pg_stat_bgwriter> view.
-
+ All the underlying functions of the pg_stat_activity> view
+ require a backend ID number.
+ The function pg_stat_get_backend_idset provides a
+ convenient way to generate one row for each active server process for
+ invoking these functions. For example, to show the
PID>s and
+ current queries of all server processes:
+
+SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
+ pg_stat_get_backend_activity(s.backendid) AS query
+ FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;
+
+
+