From d46db2591b1ffde40044a2a2b3a389f027f9f29c Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 30 Aug 2022 08:38:03 +1000 Subject: [PATCH v1] Fix ordering - stats views Rearrange the stats view sections to be alphabetically ordered. --- doc/src/sgml/monitoring.sgml | 2474 +++++++++++++++++++++--------------------- 1 file changed, 1237 insertions(+), 1237 deletions(-) diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 1d9509a..2155863 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -2317,22 +2317,25 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_replication</structname> + + <structname>pg_stat_all_indexes</structname> - pg_stat_replication + pg_stat_all_indexes - - 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. + + The pg_stat_all_indexes view will contain + 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 views + contain the same information, + but filtered to only show user and system indexes respectively. - - <structname>pg_stat_replication</structname> View +
+ <structname>pg_stat_all_indexes</structname> View @@ -2348,454 +2351,355 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - pid integer + relid oid - Process ID of a WAL sender process + OID of the table for this index - usesysid oid + indexrelid oid - OID of the user logged into this WAL sender process + OID of this index - usename name + schemaname name - Name of the user logged into this WAL sender process + Name of the schema this index is in - application_name text + relname name - Name of the application that is connected - to this WAL sender + Name of the table for this index - client_addr inet + indexrelname name - IP address of the client connected to this WAL sender. - If this field is null, it indicates that the client is - connected via a Unix socket on the server machine. + Name of this index - client_hostname text + idx_scan bigint - Host name of the connected client, as reported by a - reverse DNS lookup of client_addr. This field will - only be non-null for IP connections, and only when is enabled. + Number of index scans initiated on this index - client_port integer + idx_tup_read bigint - TCP port number that the client is using for communication - with this WAL sender, or -1 if a Unix socket is used + Number of index entries returned by scans on this index - backend_start timestamp with time zone + idx_tup_fetch bigint - Time when this process was started, i.e., when the - client connected to this WAL sender + Number of live table rows fetched by simple index scans using this + index + + +
+ + + Indexes can be used by simple index scans, bitmap index scans, + and the optimizer. 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 optimizer also accesses indexes to check for supplied constants + whose values are outside the recorded range of the optimizer statistics + because the optimizer statistics might be stale. + + + + + 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. + + + +
+ + + <structname>pg_stat_all_tables</structname> + + + pg_stat_all_tables + + + + The pg_stat_all_tables view will contain + one row for each table in the current database (including TOAST + tables), showing statistics about accesses to that specific table. The + pg_stat_user_tables and + pg_stat_sys_tables views + contain the same information, + but filtered to only show user and system tables respectively. + + + <structname>pg_stat_all_tables</structname> View + + - backend_xmin xid + Column Type - This standby's xmin horizon reported - by . + Description + + - state text + relid oid - Current WAL sender state. - Possible values are: - - - - startup: This WAL sender is starting up. - - - - - catchup: This WAL sender's connected standby is - catching up with the primary. - - - - - streaming: This WAL sender is streaming changes - after its connected standby server has caught up with the primary. - - - - - backup: This WAL sender is sending a backup. - - - - - stopping: This WAL sender is stopping. - - - + OID of a table - sent_lsn pg_lsn + schemaname name - Last write-ahead log location sent on this connection + Name of the schema that this table is in - write_lsn pg_lsn + relname name - Last write-ahead log location written to disk by this standby - server + Name of this table - flush_lsn pg_lsn + seq_scan bigint - Last write-ahead log location flushed to disk by this standby - server + Number of sequential scans initiated on this table - replay_lsn pg_lsn + seq_tup_read bigint - Last write-ahead log location replayed into the database on this - standby server + Number of live rows fetched by sequential scans - write_lag interval + idx_scan bigint - Time elapsed between flushing recent WAL locally and receiving - notification that this standby server has written it (but not yet - flushed it or applied it). This can be used to gauge the delay that - synchronous_commit level - remote_write incurred while committing if this - server was configured as a synchronous standby. + Number of index scans initiated on this table - flush_lag interval + idx_tup_fetch bigint - Time elapsed between flushing recent WAL locally and receiving - notification that this standby server has written and flushed it - (but not yet applied it). This can be used to gauge the delay that - synchronous_commit level - on incurred while committing if this - server was configured as a synchronous standby. + Number of live rows fetched by index scans - replay_lag interval + n_tup_ins bigint - Time elapsed between flushing recent WAL locally and receiving - notification that this standby server has written, flushed and - applied it. This can be used to gauge the delay that - synchronous_commit level - remote_apply incurred while committing if this - server was configured as a synchronous standby. + Number of rows inserted - sync_priority integer + n_tup_upd bigint - Priority of this standby server for being chosen as the - synchronous standby in a priority-based synchronous replication. - This has no effect in a quorum-based synchronous replication. + Number of rows updated (includes HOT updated rows) - sync_state text + n_tup_del bigint - Synchronous state of this standby server. - Possible values are: - - - - async: This standby server is asynchronous. - - - - - potential: This standby server is now asynchronous, - but can potentially become synchronous if one of current - synchronous ones fails. - - - - - sync: This standby server is synchronous. - - - - - quorum: This standby server is considered as a candidate - for quorum standbys. - - - + Number of rows deleted - reply_time timestamp with time zone + n_tup_hot_upd bigint - Send time of last reply message received from standby server + Number of rows HOT updated (i.e., with no separate index + update required) - - -
- - The lag times reported in the pg_stat_replication - view are measurements of the time taken for recent WAL to be written, - flushed and replayed and for the sender to know about it. These times - represent the commit delay that was (or would have been) introduced by each - synchronous commit level, if the remote server was configured as a - synchronous standby. For an asynchronous standby, the - replay_lag column approximates the delay - before recent transactions became visible to queries. If the standby - server has entirely caught up with the sending server and there is no more - WAL activity, the most recently measured lag times will continue to be - displayed for a short time and then show NULL. - - - - Lag times work automatically for physical replication. Logical decoding - plugins may optionally emit tracking messages; if they do not, the tracking - mechanism will simply display NULL lag. - - - - - The reported lag times are not predictions of how long it will take for - the standby to catch up with the sending server assuming the current - rate of replay. Such a system would show similar times while new WAL is - being generated, but would differ when the sender becomes idle. In - particular, when the standby has caught up completely, - pg_stat_replication shows the time taken to - write, flush and replay the most recent reported WAL location rather than - zero as some users might expect. This is consistent with the goal of - measuring synchronous commit and transaction visibility delays for - recent write transactions. - To reduce confusion for users expecting a different model of lag, the - lag columns revert to NULL after a short time on a fully replayed idle - system. Monitoring systems should choose whether to represent this - as missing data, zero or continue to display the last known value. - - - -
- - - <structname>pg_stat_replication_slots</structname> - - - pg_stat_replication_slots - - - - The pg_stat_replication_slots view will contain - one row per logical replication slot, showing statistics about its usage. - + + + n_live_tup bigint + + + Estimated number of live rows + + - - <structname>pg_stat_replication_slots</structname> View - - - Column Type - - - Description + n_dead_tup bigint + + + Estimated number of dead rows - - - slot_name text - - - A unique, cluster-wide identifier for the replication slot + n_mod_since_analyze bigint + + + Estimated number of rows modified since this table was last analyzed - spill_txns bigint - - - Number of transactions spilled to disk once the memory used by - logical decoding to decode changes from WAL has exceeded - logical_decoding_work_mem. The counter gets - incremented for both top-level transactions and subtransactions. + n_ins_since_vacuum bigint + + + Estimated number of rows inserted since this table was last vacuumed - spill_count bigint - - - Number of times transactions were spilled to disk while decoding - changes from WAL for this slot. This counter is incremented each time - a transaction is spilled, and the same transaction may be spilled - multiple times. + last_vacuum timestamp with time zone + + + Last time at which this table was manually vacuumed + (not counting VACUUM FULL) - spill_bytes bigint - - - Amount of decoded transaction data spilled to disk while performing - decoding of changes from WAL for this slot. This and other spill - counters can be used to gauge the I/O which occurred during logical - decoding and allow tuning logical_decoding_work_mem. + last_autovacuum timestamp with time zone + + + Last time at which this table was vacuumed by the autovacuum + daemon - stream_txns bigint - - - Number of in-progress transactions streamed to the decoding output - plugin after the memory used by logical decoding to decode changes - from WAL for this slot has exceeded - logical_decoding_work_mem. Streaming only - works with top-level transactions (subtransactions can't be streamed - independently), so the counter is not incremented for subtransactions. - + last_analyze timestamp with time zone + + + Last time at which this table was manually analyzed + - stream_countbigint - - - Number of times in-progress transactions were streamed to the decoding - output plugin while decoding changes from WAL for this slot. This - counter is incremented each time a transaction is streamed, and the - same transaction may be streamed multiple times. + last_autoanalyze timestamp with time zone + + + Last time at which this table was analyzed by the autovacuum + daemon - stream_bytesbigint - - - Amount of transaction data decoded for streaming in-progress - transactions to the decoding output plugin while decoding changes from - WAL for this slot. This and other streaming counters for this slot can - be used to tune logical_decoding_work_mem. - - + vacuum_count bigint + + + Number of times this table has been manually vacuumed + (not counting VACUUM FULL) + - total_txns bigint - - - Number of decoded transactions sent to the decoding output plugin for - this slot. This counts top-level transactions only, and is not incremented - for subtransactions. Note that this includes the transactions that are - streamed and/or spilled. - + autovacuum_count bigint + + + Number of times this table has been vacuumed by the autovacuum + daemon + - total_bytesbigint - - - Amount of transaction data decoded for sending transactions to the - decoding output plugin while decoding changes from WAL for this slot. - Note that this includes data that is streamed and/or spilled. - - + analyze_count bigint + + + Number of times this table has been manually analyzed + - stats_reset timestamp with time zone - - - Time at which these statistics were last reset - + autoanalyze_count bigint + + + Number of times this table has been analyzed by the autovacuum + daemon + @@ -2803,21 +2707,20 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_wal_receiver</structname> + + <structname>pg_stat_archiver</structname> - pg_stat_wal_receiver + pg_stat_archiver - The pg_stat_wal_receiver view will contain only - one row, showing statistics about the WAL receiver from that receiver's - connected server. + The pg_stat_archiver view will always have a + single row, containing data about the archiver process of the cluster. -
- <structname>pg_stat_wal_receiver</structname> View +
+ <structname>pg_stat_archiver</structname> View @@ -2833,295 +2736,211 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - pid integer - - - Process ID of the WAL receiver process - - - - - - status text + archived_count bigint - Activity status of the WAL receiver process + Number of WAL files that have been successfully archived - receive_start_lsn pg_lsn + last_archived_wal text - First write-ahead log location used when WAL receiver is - started + Name of the WAL file most recently successfully archived - receive_start_tli integer + last_archived_time timestamp with time zone - First timeline number used when WAL receiver is started + Time of the most recent successful archive operation - written_lsn pg_lsn + failed_count bigint - Last write-ahead log location already received and written to disk, - but not flushed. This should not be used for data integrity checks. + Number of failed attempts for archiving WAL files - flushed_lsn pg_lsn + last_failed_wal text - Last write-ahead log location already received and flushed to - disk, the initial value of this field being the first log location used - when WAL receiver is started + Name of the WAL file of the most recent failed archival operation - received_tli integer + last_failed_time timestamp with time zone - Timeline number of last write-ahead log location received and - flushed to disk, the initial value of this field being the timeline - number of the first log location used when WAL receiver is started + Time of the most recent failed archival operation - last_msg_send_time timestamp with time zone + stats_reset timestamp with time zone - Send time of last message received from origin WAL sender + Time at which these statistics were last reset + + +
- - - last_msg_receipt_time timestamp with time zone - - - Receipt time of last message received from origin WAL sender - - + + Normally, WAL files are archived in order, oldest to newest, but that is + not guaranteed, and does not hold under special circumstances like when + promoting a standby or after crash recovery. Therefore it is not safe to + assume that all files older than + last_archived_wal have also been successfully + archived. + + +
+ + + <structname>pg_stat_bgwriter</structname> + + pg_stat_bgwriter + + + + The pg_stat_bgwriter view will always have a + single row, containing global data for the cluster. + + + + <structname>pg_stat_bgwriter</structname> View + + - latest_end_lsn pg_lsn + Column Type - Last write-ahead log location reported to origin WAL sender + Description + + - latest_end_time timestamp with time zone + checkpoints_timed bigint - Time of last write-ahead log location reported to origin WAL sender + Number of scheduled checkpoints that have been performed - slot_name text + checkpoints_req bigint - Replication slot name used by this WAL receiver + Number of requested checkpoints that have been performed - sender_host text + checkpoint_write_time double precision - Host of the PostgreSQL instance - this WAL receiver is connected to. This can be a host name, - an IP address, or a directory path if the connection is via - Unix socket. (The path case can be distinguished because it - will always be an absolute path, beginning with /.) + Total amount of time that has been spent in the portion of + checkpoint processing where files are written to disk, in milliseconds - sender_port integer + checkpoint_sync_time double precision - Port number of the PostgreSQL instance - this WAL receiver is connected to. + Total amount of time that has been spent in the portion of + checkpoint processing where files are synchronized to disk, in + milliseconds - conninfo text + buffers_checkpoint bigint - Connection string used by this WAL receiver, - with security-sensitive fields obfuscated. + Number of buffers written during checkpoints - - -
- -
- - - <structname>pg_stat_recovery_prefetch</structname> - - - pg_stat_recovery_prefetch - - - - The pg_stat_recovery_prefetch view will contain - only one row. The columns wal_distance, - block_distance and - io_depth show current values, and the - other columns show cumulative counters that can be reset - with the pg_stat_reset_shared function. - - - <structname>pg_stat_recovery_prefetch</structname> View - - - Column Type + buffers_clean bigint - Description + Number of buffers written by the background writer - - - - - - - stats_reset timestamp with time zone - - - Time at which these statistics were last reset - - - - - - - - prefetch bigint - - - Number of blocks prefetched because they were not in the buffer pool - - - - - - - - hit bigint - - - Number of blocks not prefetched because they were already in the buffer pool - - - - - - skip_init bigint - - - Number of blocks not prefetched because they would be zero-initialized - - - - - - - - skip_new bigint - - - Number of blocks not prefetched because they didn't exist yet - - - - - - - - skip_fpw bigint - - - Number of blocks not prefetched because a full page image was included in the WAL - - + + maxwritten_clean bigint + + + Number of times the background writer stopped a cleaning + scan because it had written too many buffers + - - - skip_rep bigint - - - Number of blocks not prefetched because they were already recently prefetched - - + + buffers_backend bigint + + + Number of buffers written directly by a backend + - - - wal_distance int - - - How many bytes ahead the prefetcher is looking - - + + buffers_backend_fsync bigint + + + Number of times a backend had to execute its own + fsync call (normally the background writer handles those + even when the backend does its own write) + - - - block_distance int - - - How many blocks ahead the prefetcher is looking - - + + buffers_alloc bigint + + + Number of buffers allocated + - - - io_depth int - - - How many prefetches have been initiated but are not yet known to have completed - - + + stats_reset timestamp with time zone + + + Time at which these statistics were last reset + @@ -3129,15 +2948,21 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_subscription</structname> + + <structname>pg_stat_database</structname> - pg_stat_subscription + pg_stat_database -
- <structname>pg_stat_subscription</structname> View + + The pg_stat_database view will contain one row + for each database in the cluster, plus one for shared objects, showing + database-wide statistics. + + +
+ <structname>pg_stat_database</structname> View @@ -3153,284 +2978,293 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - subid oid + datid oid - OID of the subscription + OID of this database, or 0 for objects belonging to a shared + relation - subname name + datname name - Name of the subscription + Name of this database, or NULL for shared + objects. - pid integer + numbackends integer - Process ID of the subscription worker process + Number of backends currently connected to this database, or + NULL for shared objects. 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. - relid oid + xact_commit bigint - OID of the relation that the worker is synchronizing; null for the - main apply worker + Number of transactions in this database that have been + committed - received_lsn pg_lsn + xact_rollback bigint - Last write-ahead log location received, the initial value of - this field being 0 + Number of transactions in this database that have been + rolled back - last_msg_send_time timestamp with time zone + blks_read bigint - Send time of last message received from origin WAL sender + Number of disk blocks read in this database - last_msg_receipt_time timestamp with time zone + blks_hit bigint - Receipt time of last message received from origin WAL sender + 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 file system cache) - latest_end_lsn pg_lsn + tup_returned bigint - Last write-ahead log location reported to origin WAL sender + Number of live rows fetched by sequential scans and index entries returned by index scans in this database - latest_end_time timestamp with time zone + tup_fetched bigint - Time of last write-ahead log location reported to origin WAL - sender + Number of live rows fetched by index scans in this database - - -
- -
- - - <structname>pg_stat_subscription_stats</structname> - - - pg_stat_subscription_stats - - - - The pg_stat_subscription_stats view will contain - one row per subscription. - - - <structname>pg_stat_subscription_stats</structname> View - - - Column Type + tup_inserted bigint - Description + Number of rows inserted by queries in this database - - - subid oid + tup_updated bigint - OID of the subscription + Number of rows updated by queries in this database - subname name + tup_deleted bigint - Name of the subscription + Number of rows deleted by queries in this database - apply_error_count bigint + conflicts bigint - Number of times an error occurred while applying changes + Number of queries canceled due to conflicts with recovery + in this database. (Conflicts occur only on standby servers; see + + pg_stat_database_conflicts for details.) - sync_error_count bigint + temp_files bigint - Number of times an error occurred during the initial table - synchronization + Number of temporary files created by queries in this database. + All temporary files are counted, regardless of why the temporary file + was created (e.g., sorting or hashing), and regardless of the + setting. - stats_reset timestamp with time zone + temp_bytes bigint - Time at which these statistics were last reset + 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. - - -
-
+ + + deadlocks bigint + + + Number of deadlocks detected in this database + + - - <structname>pg_stat_ssl</structname> + + + checksum_failures bigint + + + Number of data page checksum failures detected in this + database (or on a shared object), or NULL if data checksums are not + enabled. + + - - pg_stat_ssl - + + + checksum_last_failure timestamp with time zone + + + Time at which the last data page checksum failure was detected in + this database (or on a shared object), or NULL if data checksums are not + enabled. + + - - The pg_stat_ssl view will contain one row per - backend or WAL sender process, showing statistics about SSL usage on - this connection. It can be joined to pg_stat_activity - or pg_stat_replication on the - pid column to get more details about the - connection. - + + + blk_read_time double precision + + + Time spent reading data file blocks by backends in this database, + in milliseconds (if is enabled, + otherwise zero) + + - - <structname>pg_stat_ssl</structname> View - - - Column Type + blk_write_time double precision - Description + Time spent writing data file blocks by backends in this database, + in milliseconds (if is enabled, + otherwise zero) - - - pid integer + session_time double precision - Process ID of a backend or WAL sender process + Time spent by database sessions in this database, in milliseconds + (note that statistics are only updated when the state of a session + changes, so if sessions have been idle for a long time, this idle time + won't be included) - ssl boolean + active_time double precision - True if SSL is used on this connection + Time spent executing SQL statements in this database, in milliseconds + (this corresponds to the states active and + fastpath function call in + + pg_stat_activity) - version text + idle_in_transaction_time double precision - Version of SSL in use, or NULL if SSL is not in use - on this connection + Time spent idling while in a transaction in this database, in milliseconds + (this corresponds to the states idle in transaction and + idle in transaction (aborted) in + + pg_stat_activity) - cipher text + sessions bigint - Name of SSL cipher in use, or NULL if SSL is not in use - on this connection + Total number of sessions established to this database - bits integer + sessions_abandoned bigint - Number of bits in the encryption algorithm used, or NULL - if SSL is not used on this connection + Number of database sessions to this database that were terminated + because connection to the client was lost - client_dn text + sessions_fatal bigint - Distinguished Name (DN) field from the client certificate - used, or NULL if no client certificate was supplied or if SSL - is not in use on this connection. This field is truncated if the - DN field is longer than NAMEDATALEN (64 characters - in a standard build). + Number of database sessions to this database that were terminated + by fatal errors - client_serial numeric + sessions_killed bigint - Serial number of the client certificate, or NULL if no client - certificate was supplied or if SSL is not in use on this connection. The - combination of certificate serial number and certificate issuer uniquely - identifies a certificate (unless the issuer erroneously reuses serial - numbers). + Number of database sessions to this database that were terminated + by operator intervention - issuer_dn text + stats_reset timestamp with time zone - DN of the issuer of the client certificate, or NULL if no client - certificate was supplied or if SSL is not in use on this connection. - This field is truncated like client_dn. + Time at which these statistics were last reset @@ -3439,24 +3273,23 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_gssapi</structname> + + <structname>pg_stat_database_conflicts</structname> - pg_stat_gssapi + pg_stat_database_conflicts - The pg_stat_gssapi view will contain one row per - backend, showing information about GSSAPI usage on this connection. It can - be joined to pg_stat_activity or - pg_stat_replication on the - pid column to get more details about the - connection. + 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 primary servers. -
- <structname>pg_stat_gssapi</structname> View +
+ <structname>pg_stat_database_conflicts</structname> View @@ -3472,40 +3305,69 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - pid integer + datid oid - Process ID of a backend + OID of a database - gss_authenticated boolean + datname name - True if GSSAPI authentication was used for this connection + Name of this database - principal text + confl_tablespace bigint - Principal used to authenticate this connection, or NULL - if GSSAPI was not used to authenticate this connection. This - field is truncated if the principal is longer than - NAMEDATALEN (64 characters in a standard build). + Number of queries in this database that have been canceled due to + dropped tablespaces - encrypted boolean + confl_lock bigint - True if GSSAPI encryption is in use on this connection + Number of queries in this database that have been canceled due to + lock timeouts + + + + + + confl_snapshot bigint + + + Number of queries in this database that have been canceled due to + old snapshots + + + + + + confl_bufferpin bigint + + + Number of queries in this database that have been canceled due to + pinned buffers + + + + + + confl_deadlock bigint + + + Number of queries in this database that have been canceled due to + deadlocks @@ -3514,20 +3376,24 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_archiver</structname> + + <structname>pg_stat_gssapi</structname> - pg_stat_archiver + pg_stat_gssapi - The pg_stat_archiver view will always have a - single row, containing data about the archiver process of the cluster. + The pg_stat_gssapi view will contain one row per + backend, showing information about GSSAPI usage on this connection. It can + be joined to pg_stat_activity or + pg_stat_replication on the + pid column to get more details about the + connection. -
- <structname>pg_stat_archiver</structname> View +
+ <structname>pg_stat_gssapi</structname> View @@ -3543,95 +3409,210 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - archived_count bigint + pid integer - Number of WAL files that have been successfully archived + Process ID of a backend - last_archived_wal text + gss_authenticated boolean - Name of the WAL file most recently successfully archived + True if GSSAPI authentication was used for this connection - last_archived_time timestamp with time zone + principal text - Time of the most recent successful archive operation + Principal used to authenticate this connection, or NULL + if GSSAPI was not used to authenticate this connection. This + field is truncated if the principal is longer than + NAMEDATALEN (64 characters in a standard build). - failed_count bigint + encrypted boolean - Number of failed attempts for archiving WAL files + True if GSSAPI encryption is in use on this connection + + +
+ +
+ + + <structname>pg_stat_recovery_prefetch</structname> + + + pg_stat_recovery_prefetch + + + + The pg_stat_recovery_prefetch view will contain + only one row. The columns wal_distance, + block_distance and + io_depth show current values, and the + other columns show cumulative counters that can be reset + with the pg_stat_reset_shared function. + + + <structname>pg_stat_recovery_prefetch</structname> View + + - last_failed_wal text + Column Type - Name of the WAL file of the most recent failed archival operation + Description + + - - last_failed_time timestamp with time zone - - - Time of the most recent failed archival operation - + + + stats_reset timestamp with time zone + + + Time at which these statistics were last reset + + - - stats_reset timestamp with time zone - - - Time at which these statistics were last reset - + + + prefetch bigint + + + Number of blocks prefetched because they were not in the buffer pool + + + + + + + + hit bigint + + + Number of blocks not prefetched because they were already in the buffer pool + + + + + + + + skip_init bigint + + + Number of blocks not prefetched because they would be zero-initialized + + + + + + + + skip_new bigint + + + Number of blocks not prefetched because they didn't exist yet + + + + + + + + skip_fpw bigint + + + Number of blocks not prefetched because a full page image was included in the WAL + + + + + + + + skip_rep bigint + + + Number of blocks not prefetched because they were already recently prefetched + + + + + + + + wal_distance int + + + How many bytes ahead the prefetcher is looking + + + + + + + + block_distance int + + + How many blocks ahead the prefetcher is looking + + + + + + + + io_depth int + + + How many prefetches have been initiated but are not yet known to have completed + +
- - Normally, WAL files are archived in order, oldest to newest, but that is - not guaranteed, and does not hold under special circumstances like when - promoting a standby or after crash recovery. Therefore it is not safe to - assume that all files older than - last_archived_wal have also been successfully - archived. - -
- - <structname>pg_stat_bgwriter</structname> + + <structname>pg_stat_replication</structname> - pg_stat_bgwriter + pg_stat_replication - - The pg_stat_bgwriter view will always have a - single row, containing global data for the cluster. + + 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. - - <structname>pg_stat_bgwriter</structname> View +
+ <structname>pg_stat_replication</structname> View @@ -3647,271 +3628,334 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - checkpoints_timed bigint + pid integer - Number of scheduled checkpoints that have been performed + Process ID of a WAL sender process - checkpoints_req bigint + usesysid oid - Number of requested checkpoints that have been performed + OID of the user logged into this WAL sender process - checkpoint_write_time double precision + usename name - Total amount of time that has been spent in the portion of - checkpoint processing where files are written to disk, in milliseconds + Name of the user logged into this WAL sender process - checkpoint_sync_time double precision + application_name text - Total amount of time that has been spent in the portion of - checkpoint processing where files are synchronized to disk, in - milliseconds - - - - - - buffers_checkpoint bigint - - - Number of buffers written during checkpoints + Name of the application that is connected + to this WAL sender - buffers_clean bigint + client_addr inet - Number of buffers written by the background writer + IP address of the client connected to this WAL sender. + If this field is null, it indicates that the client is + connected via a Unix socket on the server machine. - maxwritten_clean bigint + client_hostname text - Number of times the background writer stopped a cleaning - scan because it had written too many buffers + Host name of the connected client, as reported by a + reverse DNS lookup of client_addr. This field will + only be non-null for IP connections, and only when is enabled. - buffers_backend bigint + client_port integer - Number of buffers written directly by a backend + TCP port number that the client is using for communication + with this WAL sender, or -1 if a Unix socket is used - buffers_backend_fsync bigint + backend_start timestamp with time zone - Number of times a backend had to execute its own - fsync call (normally the background writer handles those - even when the backend does its own write) + Time when this process was started, i.e., when the + client connected to this WAL sender - buffers_alloc bigint + backend_xmin xid - Number of buffers allocated + This standby's xmin horizon reported + by . - stats_reset timestamp with time zone + state text - Time at which these statistics were last reset + Current WAL sender state. + Possible values are: + + + + startup: This WAL sender is starting up. + + + + + catchup: This WAL sender's connected standby is + catching up with the primary. + + + + + streaming: This WAL sender is streaming changes + after its connected standby server has caught up with the primary. + + + + + backup: This WAL sender is sending a backup. + + + + + stopping: This WAL sender is stopping. + + + - - -
-
- - - <structname>pg_stat_wal</structname> - - - pg_stat_wal - - - - The pg_stat_wal view will always have a - single row, containing data about WAL activity of the cluster. - - - - <structname>pg_stat_wal</structname> View - - - Column Type + sent_lsn pg_lsn - Description + Last write-ahead log location sent on this connection - - - wal_records bigint + write_lsn pg_lsn - Total number of WAL records generated + Last write-ahead log location written to disk by this standby + server - wal_fpi bigint + flush_lsn pg_lsn - Total number of WAL full page images generated + Last write-ahead log location flushed to disk by this standby + server - wal_bytes numeric + replay_lsn pg_lsn - Total amount of WAL generated in bytes + Last write-ahead log location replayed into the database on this + standby server - wal_buffers_full bigint + write_lag interval - Number of times WAL data was written to disk because WAL buffers became full + Time elapsed between flushing recent WAL locally and receiving + notification that this standby server has written it (but not yet + flushed it or applied it). This can be used to gauge the delay that + synchronous_commit level + remote_write incurred while committing if this + server was configured as a synchronous standby. - wal_write bigint + flush_lag interval - Number of times WAL buffers were written out to disk via - XLogWrite request. - See for more information about - the internal WAL function XLogWrite. + Time elapsed between flushing recent WAL locally and receiving + notification that this standby server has written and flushed it + (but not yet applied it). This can be used to gauge the delay that + synchronous_commit level + on incurred while committing if this + server was configured as a synchronous standby. - wal_sync bigint + replay_lag interval - Number of times WAL files were synced to disk via - issue_xlog_fsync request - (if is on and - is either - fdatasync, fsync or - fsync_writethrough, otherwise zero). - See for more information about - the internal WAL function issue_xlog_fsync. + Time elapsed between flushing recent WAL locally and receiving + notification that this standby server has written, flushed and + applied it. This can be used to gauge the delay that + synchronous_commit level + remote_apply incurred while committing if this + server was configured as a synchronous standby. - wal_write_time double precision + sync_priority integer - Total amount of time spent writing WAL buffers to disk via - XLogWrite request, in milliseconds - (if is enabled, - otherwise zero). This includes the sync time when - wal_sync_method is either - open_datasync or open_sync. + Priority of this standby server for being chosen as the + synchronous standby in a priority-based synchronous replication. + This has no effect in a quorum-based synchronous replication. - wal_sync_time double precision + sync_state text - Total amount of time spent syncing WAL files to disk via - issue_xlog_fsync request, in milliseconds - (if track_wal_io_timing is enabled, - fsync is on, and - wal_sync_method is either - fdatasync, fsync or - fsync_writethrough, otherwise zero). + Synchronous state of this standby server. + Possible values are: + + + + async: This standby server is asynchronous. + + + + + potential: This standby server is now asynchronous, + but can potentially become synchronous if one of current + synchronous ones fails. + + + + + sync: This standby server is synchronous. + + + + + quorum: This standby server is considered as a candidate + for quorum standbys. + + + - stats_reset timestamp with time zone + reply_time timestamp with time zone - Time at which these statistics were last reset + Send time of last reply message received from standby server - +
-
+ + The lag times reported in the pg_stat_replication + view are measurements of the time taken for recent WAL to be written, + flushed and replayed and for the sender to know about it. These times + represent the commit delay that was (or would have been) introduced by each + synchronous commit level, if the remote server was configured as a + synchronous standby. For an asynchronous standby, the + replay_lag column approximates the delay + before recent transactions became visible to queries. If the standby + server has entirely caught up with the sending server and there is no more + WAL activity, the most recently measured lag times will continue to be + displayed for a short time and then show NULL. + - - <structname>pg_stat_database</structname> + + Lag times work automatically for physical replication. Logical decoding + plugins may optionally emit tracking messages; if they do not, the tracking + mechanism will simply display NULL lag. + + + + + The reported lag times are not predictions of how long it will take for + the standby to catch up with the sending server assuming the current + rate of replay. Such a system would show similar times while new WAL is + being generated, but would differ when the sender becomes idle. In + particular, when the standby has caught up completely, + pg_stat_replication shows the time taken to + write, flush and replay the most recent reported WAL location rather than + zero as some users might expect. This is consistent with the goal of + measuring synchronous commit and transaction visibility delays for + recent write transactions. + To reduce confusion for users expecting a different model of lag, the + lag columns revert to NULL after a short time on a fully replayed idle + system. Monitoring systems should choose whether to represent this + as missing data, zero or continue to display the last known value. + + + + + + + <structname>pg_stat_replication_slots</structname> - pg_stat_database + pg_stat_replication_slots - The pg_stat_database view will contain one row - for each database in the cluster, plus one for shared objects, showing - database-wide statistics. + The pg_stat_replication_slots view will contain + one row per logical replication slot, showing statistics about its usage. - - <structname>pg_stat_database</structname> View +
+ <structname>pg_stat_replication_slots</structname> View - Column Type - - - Description + Column Type + + + Description @@ -3919,284 +3963,231 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - datid oid - - - OID of this database, or 0 for objects belonging to a shared - relation - - - - - - datname name - - - Name of this database, or NULL for shared - objects. - - - - - - numbackends integer - - - Number of backends currently connected to this database, or - NULL for shared objects. 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. - - - - - - xact_commit bigint - - - Number of transactions in this database that have been - committed - - - - - - xact_rollback bigint - - - Number of transactions in this database that have been - rolled back - - - - - - blks_read bigint - - - Number of disk blocks read in this database - - - - - - blks_hit bigint - - - 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 file system cache) - - - - - - tup_returned bigint - - - Number of live rows fetched by sequential scans and index entries returned by index scans in this database - - - - - - tup_fetched bigint - - - Number of live rows fetched by index scans in this database + slot_name text + + + A unique, cluster-wide identifier for the replication slot - tup_inserted bigint - - - Number of rows inserted by queries in this database + spill_txns bigint + + + Number of transactions spilled to disk once the memory used by + logical decoding to decode changes from WAL has exceeded + logical_decoding_work_mem. The counter gets + incremented for both top-level transactions and subtransactions. - tup_updated bigint - - - Number of rows updated by queries in this database + spill_count bigint + + + Number of times transactions were spilled to disk while decoding + changes from WAL for this slot. This counter is incremented each time + a transaction is spilled, and the same transaction may be spilled + multiple times. - tup_deleted bigint - - - Number of rows deleted by queries in this database + spill_bytes bigint + + + Amount of decoded transaction data spilled to disk while performing + decoding of changes from WAL for this slot. This and other spill + counters can be used to gauge the I/O which occurred during logical + decoding and allow tuning logical_decoding_work_mem. - conflicts bigint - - - Number of queries canceled due to conflicts with recovery - in this database. (Conflicts occur only on standby servers; see - - pg_stat_database_conflicts for details.) - + stream_txns bigint + + + Number of in-progress transactions streamed to the decoding output + plugin after the memory used by logical decoding to decode changes + from WAL for this slot has exceeded + logical_decoding_work_mem. Streaming only + works with top-level transactions (subtransactions can't be streamed + independently), so the counter is not incremented for subtransactions. + - temp_files bigint - - - Number of temporary files created by queries in this database. - All temporary files are counted, regardless of why the temporary file - was created (e.g., sorting or hashing), and regardless of the - setting. + stream_countbigint + + + Number of times in-progress transactions were streamed to the decoding + output plugin while decoding changes from WAL for this slot. This + counter is incremented each time a transaction is streamed, and the + same transaction may be streamed multiple times. - temp_bytes bigint - - - 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. - + stream_bytesbigint + + + Amount of transaction data decoded for streaming in-progress + transactions to the decoding output plugin while decoding changes from + WAL for this slot. This and other streaming counters for this slot can + be used to tune logical_decoding_work_mem. + + - deadlocks bigint - - - Number of deadlocks detected in this database - + total_txns bigint + + + Number of decoded transactions sent to the decoding output plugin for + this slot. This counts top-level transactions only, and is not incremented + for subtransactions. Note that this includes the transactions that are + streamed and/or spilled. + - checksum_failures bigint - - - Number of data page checksum failures detected in this - database (or on a shared object), or NULL if data checksums are not - enabled. - + total_bytesbigint + + + Amount of transaction data decoded for sending transactions to the + decoding output plugin while decoding changes from WAL for this slot. + Note that this includes data that is streamed and/or spilled. + + - checksum_last_failure timestamp with time zone - - - Time at which the last data page checksum failure was detected in - this database (or on a shared object), or NULL if data checksums are not - enabled. - + stats_reset timestamp with time zone + + + Time at which these statistics were last reset + + + +
+ +
+ + <structname>pg_stat_slru</structname> + + + SLRU + + + + pg_stat_slru + + + + PostgreSQL accesses certain on-disk information + via SLRU (simple least-recently-used) caches. + The pg_stat_slru view will contain + one row for each tracked SLRU cache, showing statistics about access + to cached pages. + + + + <structname>pg_stat_slru</structname> View + + - blk_read_time double precision + Column Type - Time spent reading data file blocks by backends in this database, - in milliseconds (if is enabled, - otherwise zero) + Description + + - blk_write_time double precision + name text - Time spent writing data file blocks by backends in this database, - in milliseconds (if is enabled, - otherwise zero) + Name of the SLRU - session_time double precision + blks_zeroed bigint - Time spent by database sessions in this database, in milliseconds - (note that statistics are only updated when the state of a session - changes, so if sessions have been idle for a long time, this idle time - won't be included) + Number of blocks zeroed during initializations - active_time double precision + blks_hit bigint - Time spent executing SQL statements in this database, in milliseconds - (this corresponds to the states active and - fastpath function call in - - pg_stat_activity) + Number of times disk blocks were found already in the SLRU, + so that a read was not necessary (this only includes hits in the + SLRU, not the operating system's file system cache) - idle_in_transaction_time double precision + blks_read bigint - Time spent idling while in a transaction in this database, in milliseconds - (this corresponds to the states idle in transaction and - idle in transaction (aborted) in - - pg_stat_activity) + Number of disk blocks read for this SLRU - sessions bigint + blks_written bigint - Total number of sessions established to this database + Number of disk blocks written for this SLRU - sessions_abandoned bigint + blks_exists bigint - Number of database sessions to this database that were terminated - because connection to the client was lost + Number of blocks checked for existence for this SLRU - sessions_fatal bigint + flushes bigint - Number of database sessions to this database that were terminated - by fatal errors + Number of flushes of dirty data for this SLRU - sessions_killed bigint + truncates bigint - Number of database sessions to this database that were terminated - by operator intervention + Number of truncates for this SLRU @@ -4214,23 +4205,24 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_database_conflicts</structname> + + <structname>pg_stat_ssl</structname> - pg_stat_database_conflicts + pg_stat_ssl - 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 primary servers. + The pg_stat_ssl view will contain one row per + backend or WAL sender process, showing statistics about SSL usage on + this connection. It can be joined to pg_stat_activity + or pg_stat_replication on the + pid column to get more details about the + connection. -
- <structname>pg_stat_database_conflicts</structname> View +
+ <structname>pg_stat_ssl</structname> View @@ -4246,69 +4238,86 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - datid oid + pid integer - OID of a database + Process ID of a backend or WAL sender process - datname name + ssl boolean - Name of this database + True if SSL is used on this connection - confl_tablespace bigint + version text - Number of queries in this database that have been canceled due to - dropped tablespaces + Version of SSL in use, or NULL if SSL is not in use + on this connection - confl_lock bigint + cipher text - Number of queries in this database that have been canceled due to - lock timeouts + Name of SSL cipher in use, or NULL if SSL is not in use + on this connection - confl_snapshot bigint + bits integer - Number of queries in this database that have been canceled due to - old snapshots + Number of bits in the encryption algorithm used, or NULL + if SSL is not used on this connection - confl_bufferpin bigint + client_dn text - Number of queries in this database that have been canceled due to - pinned buffers + Distinguished Name (DN) field from the client certificate + used, or NULL if no client certificate was supplied or if SSL + is not in use on this connection. This field is truncated if the + DN field is longer than NAMEDATALEN (64 characters + in a standard build). - confl_deadlock bigint + client_serial numeric - Number of queries in this database that have been canceled due to - deadlocks + Serial number of the client certificate, or NULL if no client + certificate was supplied or if SSL is not in use on this connection. The + combination of certificate serial number and certificate issuer uniquely + identifies a certificate (unless the issuer erroneously reuses serial + numbers). + + + + + + issuer_dn text + + + DN of the issuer of the client certificate, or NULL if no client + certificate was supplied or if SSL is not in use on this connection. + This field is truncated like client_dn. @@ -4317,25 +4326,15 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_all_tables</structname> + + <structname>pg_stat_subscription</structname> - pg_stat_all_tables + pg_stat_subscription - - The pg_stat_all_tables view will contain - one row for each table in the current database (including TOAST - tables), showing statistics about accesses to that specific table. The - pg_stat_user_tables and - pg_stat_sys_tables views - contain the same information, - but filtered to only show user and system tables respectively. - - -
- <structname>pg_stat_all_tables</structname> View +
+ <structname>pg_stat_subscription</structname> View @@ -4351,215 +4350,253 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - relid oid - - - OID of a table - - - - - - schemaname name + subid oid - Name of the schema that this table is in + OID of the subscription - relname name + subname name - Name of this table + Name of the subscription - seq_scan bigint + pid integer - Number of sequential scans initiated on this table + Process ID of the subscription worker process - seq_tup_read bigint + relid oid - Number of live rows fetched by sequential scans + OID of the relation that the worker is synchronizing; null for the + main apply worker - idx_scan bigint + received_lsn pg_lsn - Number of index scans initiated on this table + Last write-ahead log location received, the initial value of + this field being 0 - idx_tup_fetch bigint + last_msg_send_time timestamp with time zone - Number of live rows fetched by index scans + Send time of last message received from origin WAL sender - n_tup_ins bigint + last_msg_receipt_time timestamp with time zone - Number of rows inserted + Receipt time of last message received from origin WAL sender - n_tup_upd bigint + latest_end_lsn pg_lsn - Number of rows updated (includes HOT updated rows) + Last write-ahead log location reported to origin WAL sender - n_tup_del bigint + latest_end_time timestamp with time zone - Number of rows deleted + Time of last write-ahead log location reported to origin WAL + sender + + +
+ +
+ + + <structname>pg_stat_subscription_stats</structname> + + + pg_stat_subscription_stats + + + + The pg_stat_subscription_stats view will contain + one row per subscription. + + + <structname>pg_stat_subscription_stats</structname> View + + - n_tup_hot_upd bigint + Column Type - Number of rows HOT updated (i.e., with no separate index - update required) + Description + + - n_live_tup bigint + subid oid - Estimated number of live rows + OID of the subscription - n_dead_tup bigint + subname name - Estimated number of dead rows + Name of the subscription - n_mod_since_analyze bigint + apply_error_count bigint - Estimated number of rows modified since this table was last analyzed + Number of times an error occurred while applying changes - n_ins_since_vacuum bigint + sync_error_count bigint - Estimated number of rows inserted since this table was last vacuumed + Number of times an error occurred during the initial table + synchronization - last_vacuum timestamp with time zone + stats_reset timestamp with time zone - Last time at which this table was manually vacuumed - (not counting VACUUM FULL) + Time at which these statistics were last reset + + +
+ +
+ + + <structname>pg_stat_user_functions</structname> + + + pg_stat_user_functions + + + + The pg_stat_user_functions view will contain + one row for each tracked function, showing statistics about executions of + that function. The parameter + controls exactly which functions are tracked. + + + <structname>pg_stat_user_functions</structname> View + + - last_autovacuum timestamp with time zone + Column Type - Last time at which this table was vacuumed by the autovacuum - daemon + Description + + - last_analyze timestamp with time zone + funcid oid - Last time at which this table was manually analyzed + OID of a function - last_autoanalyze timestamp with time zone + schemaname name - Last time at which this table was analyzed by the autovacuum - daemon + Name of the schema this function is in - vacuum_count bigint + funcname name - Number of times this table has been manually vacuumed - (not counting VACUUM FULL) + Name of this function - autovacuum_count bigint + calls bigint - Number of times this table has been vacuumed by the autovacuum - daemon + Number of times this function has been called - analyze_count bigint + total_time double precision - Number of times this table has been manually analyzed + Total time spent in this function and all other functions + called by it, in milliseconds - autoanalyze_count bigint + self_time double precision - Number of times this table has been analyzed by the autovacuum - daemon + Total time spent in this function itself, not including + other functions called by it, in milliseconds @@ -4568,25 +4605,20 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_all_indexes</structname> + + <structname>pg_stat_wal</structname> - pg_stat_all_indexes + pg_stat_wal - The pg_stat_all_indexes view will contain - 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 views - contain the same information, - but filtered to only show user and system indexes respectively. + The pg_stat_wal view will always have a + single row, containing data about WAL activity of the cluster. -
- <structname>pg_stat_all_indexes</structname> View +
+ <structname>pg_stat_wal</structname> View @@ -4602,130 +4634,126 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - relid oid + wal_records bigint - OID of the table for this index + Total number of WAL records generated - indexrelid oid + wal_fpi bigint - OID of this index + Total number of WAL full page images generated - schemaname name + wal_bytes numeric - Name of the schema this index is in + Total amount of WAL generated in bytes - relname name + wal_buffers_full bigint - Name of the table for this index + Number of times WAL data was written to disk because WAL buffers became full - indexrelname name + wal_write bigint - Name of this index + Number of times WAL buffers were written out to disk via + XLogWrite request. + See for more information about + the internal WAL function XLogWrite. - idx_scan bigint + wal_sync bigint - Number of index scans initiated on this index + Number of times WAL files were synced to disk via + issue_xlog_fsync request + (if is on and + is either + fdatasync, fsync or + fsync_writethrough, otherwise zero). + See for more information about + the internal WAL function issue_xlog_fsync. - idx_tup_read bigint + wal_write_time double precision - Number of index entries returned by scans on this index + Total amount of time spent writing WAL buffers to disk via + XLogWrite request, in milliseconds + (if is enabled, + otherwise zero). This includes the sync time when + wal_sync_method is either + open_datasync or open_sync. - idx_tup_fetch bigint + wal_sync_time double precision - Number of live table rows fetched by simple index scans using this - index + Total amount of time spent syncing WAL files to disk via + issue_xlog_fsync request, in milliseconds + (if track_wal_io_timing is enabled, + fsync is on, and + wal_sync_method is either + fdatasync, fsync or + fsync_writethrough, otherwise zero). - + + + + stats_reset timestamp with time zone + + + Time at which these statistics were last reset + + +
- - Indexes can be used by simple index scans, bitmap index scans, - and the optimizer. 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 optimizer also accesses indexes to check for supplied constants - whose values are outside the recorded range of the optimizer statistics - because the optimizer statistics might be stale. - - - - - 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. - - - -
+
- - <structname>pg_statio_all_tables</structname> + + <structname>pg_stat_wal_receiver</structname> - pg_statio_all_tables + pg_stat_wal_receiver - The pg_statio_all_tables view will contain - one row for each table in the current database (including TOAST - tables), showing statistics about I/O on that specific table. The - pg_statio_user_tables and - pg_statio_sys_tables views - contain the same information, - but filtered to only show user and system tables respectively. + The pg_stat_wal_receiver view will contain only + one row, showing statistics about the WAL receiver from that receiver's + connected server. - - <structname>pg_statio_all_tables</structname> View +
+ <structname>pg_stat_wal_receiver</structname> View @@ -4741,100 +4769,148 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - relid oid + pid integer - OID of a table + Process ID of the WAL receiver process - schemaname name + status text - Name of the schema that this table is in + Activity status of the WAL receiver process - relname name + receive_start_lsn pg_lsn - Name of this table + First write-ahead log location used when WAL receiver is + started - heap_blks_read bigint + receive_start_tli integer - Number of disk blocks read from this table + First timeline number used when WAL receiver is started - heap_blks_hit bigint + written_lsn pg_lsn - Number of buffer hits in this table + Last write-ahead log location already received and written to disk, + but not flushed. This should not be used for data integrity checks. - idx_blks_read bigint + flushed_lsn pg_lsn - Number of disk blocks read from all indexes on this table + Last write-ahead log location already received and flushed to + disk, the initial value of this field being the first log location used + when WAL receiver is started - idx_blks_hit bigint + received_tli integer - Number of buffer hits in all indexes on this table + Timeline number of last write-ahead log location received and + flushed to disk, the initial value of this field being the timeline + number of the first log location used when WAL receiver is started - toast_blks_read bigint + last_msg_send_time timestamp with time zone - Number of disk blocks read from this table's TOAST table (if any) + Send time of last message received from origin WAL sender - toast_blks_hit bigint + last_msg_receipt_time timestamp with time zone - Number of buffer hits in this table's TOAST table (if any) + Receipt time of last message received from origin WAL sender - tidx_blks_read bigint + latest_end_lsn pg_lsn - Number of disk blocks read from this table's TOAST table indexes (if any) + Last write-ahead log location reported to origin WAL sender - tidx_blks_hit bigint + latest_end_time timestamp with time zone - Number of buffer hits in this table's TOAST table indexes (if any) + Time of last write-ahead log location reported to origin WAL sender + + + + + + slot_name text + + + Replication slot name used by this WAL receiver + + + + + + sender_host text + + + Host of the PostgreSQL instance + this WAL receiver is connected to. This can be a host name, + an IP address, or a directory path if the connection is via + Unix socket. (The path case can be distinguished because it + will always be an absolute path, beginning with /.) + + + + + + sender_port integer + + + Port number of the PostgreSQL instance + this WAL receiver is connected to. + + + + + + conninfo text + + + Connection string used by this WAL receiver, + with security-sensitive fields obfuscated. @@ -5021,22 +5097,25 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - <structname>pg_stat_user_functions</structname> + + <structname>pg_statio_all_tables</structname> - pg_stat_user_functions + pg_statio_all_tables - The pg_stat_user_functions view will contain - one row for each tracked function, showing statistics about executions of - that function. The parameter - controls exactly which functions are tracked. + The pg_statio_all_tables view will contain + one row for each table in the current database (including TOAST + tables), showing statistics about I/O on that specific table. The + pg_statio_user_tables and + pg_statio_sys_tables views + contain the same information, + but filtered to only show user and system tables respectively. -
- <structname>pg_stat_user_functions</structname> View +
+ <structname>pg_statio_all_tables</structname> View @@ -5052,10 +5131,10 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - funcid oid + relid oid - OID of a function + OID of a table @@ -5064,167 +5143,88 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i schemanamename - Name of the schema this function is in - - - - - - funcname name - - - Name of this function - - - - - - calls bigint - - - Number of times this function has been called - - - - - - total_time double precision - - - Total time spent in this function and all other functions - called by it, in milliseconds - - - - - - self_time double precision - - - Total time spent in this function itself, not including - other functions called by it, in milliseconds - - - - -
- -
- - - <structname>pg_stat_slru</structname> - - - SLRU - - - - pg_stat_slru - - - - PostgreSQL accesses certain on-disk information - via SLRU (simple least-recently-used) caches. - The pg_stat_slru view will contain - one row for each tracked SLRU cache, showing statistics about access - to cached pages. - - - - <structname>pg_stat_slru</structname> View - - - - - Column Type - - - Description + Name of the schema that this table is in - - - name text + relname name - Name of the SLRU + Name of this table - blks_zeroed bigint + heap_blks_read bigint - Number of blocks zeroed during initializations + Number of disk blocks read from this table - blks_hit bigint + heap_blks_hit bigint - Number of times disk blocks were found already in the SLRU, - so that a read was not necessary (this only includes hits in the - SLRU, not the operating system's file system cache) + Number of buffer hits in this table - blks_read bigint + idx_blks_read bigint - Number of disk blocks read for this SLRU + Number of disk blocks read from all indexes on this table - blks_written bigint + idx_blks_hit bigint - Number of disk blocks written for this SLRU + Number of buffer hits in all indexes on this table - blks_exists bigint + toast_blks_read bigint - Number of blocks checked for existence for this SLRU + Number of disk blocks read from this table's TOAST table (if any) - flushes bigint + toast_blks_hit bigint - Number of flushes of dirty data for this SLRU + Number of buffer hits in this table's TOAST table (if any) - truncates bigint + tidx_blks_read bigint - Number of truncates for this SLRU + Number of disk blocks read from this table's TOAST table indexes (if any) - stats_reset timestamp with time zone + tidx_blks_hit bigint - Time at which these statistics were last reset + Number of buffer hits in this table's TOAST table indexes (if any) -- 1.8.3.1