diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 9851ef2713..632e6d23f7 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -10455,8 +10455,9 @@ SCRAM-SHA-256$<iteration count>:&l The pid column can be joined to the - pid column of the pg_stat_activity + pid column of the + + pg_stat_activity view to get more information on the session holding or awaiting each lock, for example diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index a2694e548a..4eef970d41 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -3889,9 +3889,9 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows The synchronous standbys will be those whose names appear in this list, and that are both currently connected and streaming data in real-time - (as shown by a state of streaming in the pg_stat_replication - view). + (as shown by a state of streaming in the + + pg_stat_replication view). Specifying more than one synchronous standby can allow for very high availability and protection against data loss. @@ -4244,8 +4244,8 @@ ANY num_sync ( pg_stat_replication + + pg_stat_replication view. The standby will report the last write-ahead log location it has written, the last position it has flushed to disk, and the last position it has applied. @@ -6694,8 +6694,10 @@ local0.* /var/log/postgresql The backend type corresponds to the column - backend_type in the view , but additional types can appear + backend_type in the view + + pg_stat_activity, + but additional types can appear in the log that don't show in that view. @@ -7191,7 +7193,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; platforms. You can use the tool to measure the overhead of timing on your system. I/O timing information is - displayed in , in the output of + displayed in + pg_stat_database, in the output of when the BUFFERS option is used, and by . Only superusers can change this setting. diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index 805e100055..65c3fc62a9 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -895,7 +895,8 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' You can retrieve a list of WAL sender processes via the - view. Large differences between + + pg_stat_replication view. Large differences between pg_current_wal_lsn and the view's sent_lsn field might indicate that the master server is under heavy load, while differences between sent_lsn and @@ -904,7 +905,8 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' On a hot standby, the status of the WAL receiver process can be retrieved - via the view. A large + via the + pg_stat_wal_receiver view. A large difference between pg_last_wal_replay_lsn and the view's flushed_lsn indicates that WAL is being received faster than it can be replayed. diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index eba331a72b..e19bb3fd65 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -495,7 +495,8 @@ The monitoring information about subscription is visible in - pg_stat_subscription. + + pg_stat_subscription. This view contains one row for every subscription worker. A subscription can have zero or more active subscription workers depending on its state. diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index bad3bfe620..c89f93cf6b 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -347,7 +347,8 @@ $ pg_recvlogical -d postgres --slot=test --drop-slot The pg_replication_slots view and the - pg_stat_replication + + pg_stat_replication view provide information about the current state of replication slots and streaming replication connections respectively. These views apply to both physical and logical replication. diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 49d4bb13b9..321a0f4bb1 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -300,7 +300,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row per server process, showing information related to the current activity of that process, such as state and current query. - See for details. + See + pg_stat_activity for details. @@ -308,7 +309,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_replicationpg_stat_replication One row per WAL sender process, showing statistics about replication to that sender's connected standby server. - See for details. + See + pg_stat_replication for details. @@ -316,7 +318,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_wal_receiverpg_stat_wal_receiver Only one row, showing statistics about the WAL receiver from that receiver's connected server. - See for details. + See + pg_stat_wal_receiver for details. @@ -324,7 +327,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_subscriptionpg_stat_subscription At least one row per subscription, showing information about the subscription workers. - See for details. + See + pg_stat_subscription for details. @@ -332,7 +336,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_sslpg_stat_ssl One row per connection (regular and replication), showing information about SSL used on this connection. - See for details. + See + pg_stat_ssl for details. @@ -340,7 +345,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_gssapipg_stat_gssapi One row per connection (regular and replication), showing information about GSSAPI authentication and encryption used on this connection. - See for details. + See + pg_stat_gssapi for details. @@ -404,7 +410,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_archiverpg_stat_archiver One row only, showing statistics about the WAL archiver process's activity. See - for details. + + pg_stat_archiver for details. @@ -412,14 +419,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_bgwriterpg_stat_bgwriter One row only, showing statistics about the background writer process's activity. See - for details. + + pg_stat_bgwriter for details. pg_stat_databasepg_stat_database One row per database, showing database-wide statistics. See - for details. + + pg_stat_database for details. @@ -428,7 +437,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row per database, showing database-wide statistics about query cancels due to conflict with recovery on standby servers. - See for details. + See + pg_stat_database_conflicts for details. @@ -437,7 +447,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row for each table in the current database, showing statistics about accesses to that specific table. - See for details. + See + pg_stat_all_tables for details. @@ -479,7 +490,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row for each index in the current database, showing statistics about accesses to that specific index. - See for details. + See + pg_stat_all_indexes for details. @@ -500,7 +512,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row for each table in the current database, showing statistics about I/O on that specific table. - See for details. + See + pg_statio_all_tables for details. @@ -521,7 +534,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row for each index in the current database, showing statistics about I/O on that specific index. - See for details. + See + pg_statio_all_indexes for details. @@ -542,7 +556,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row for each sequence in the current database, showing statistics about I/O on that specific sequence. - See for details. + See + pg_statio_all_sequences for details. @@ -564,7 +579,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser One row for each tracked function, showing statistics about executions of that function. See - for details. + + pg_stat_user_functions for details. @@ -578,7 +594,8 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_slrupg_stat_slru One row per SLRU, showing statistics of operations. See - for details. + + pg_stat_slru for details. @@ -608,6 +625,20 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser into the kernel's handling of I/O. + + + + <structname>pg_stat_activity</structname> + + + pg_stat_activity + + + + The pg_stat_activity view will have one row + per server process, showing information related to + the current activity of that process. + <structname>pg_stat_activity</structname> View @@ -889,12 +920,6 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
- - The pg_stat_activity view will have one row - per server process, showing information related to - the current activity of that process. - - The wait_event and state columns are @@ -2135,14 +2160,30 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event is NOT NULL; - pid | wait_event_type | wait_event -------+-----------------+--------------- + pid | wait_event_type | wait_event +------+-----------------+------------ 2540 | Lock | relation - 6644 | LWLock | ProcArrayLock + 6644 | LWLock | ProcArray (2 rows) +
+ + + <structname>pg_stat_replication</structname> + + + pg_stat_replication + + + + 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_replication</structname> View @@ -2457,13 +2498,6 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
- - 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 lag times reported in the pg_stat_replication view are measurements of the time taken for recent WAL to be written, @@ -2503,6 +2537,21 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i +
+ + + <structname>pg_stat_wal_receiver</structname> + + + pg_stat_wal_receiver + + + + 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_stat_wal_receiver</structname> View @@ -2668,10 +2717,20 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_subscription</structname> + + + pg_stat_subscription + + - 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_subscription view will contain one + row per subscription for main worker (with null PID if the worker is + not running), and additional rows for workers handling the initial data + copy of the subscribed tables. @@ -2776,11 +2835,22 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_ssl</structname> + + + pg_stat_ssl + + - The pg_stat_subscription view will contain one - row per subscription for main worker (with null PID if the worker is - not running), and additional rows for workers handling the initial data - copy of the subscribed tables. + 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. @@ -2896,11 +2966,20 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_gssapi</structname> + + + pg_stat_gssapi + + - 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 + 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. @@ -2962,16 +3041,20 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i + + + + <structname>pg_stat_archiver</structname> + + + pg_stat_archiver + + - 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_archiver view will always have a + single row, containing data about the archiver process of the cluster. - <structname>pg_stat_archiver</structname> View @@ -3053,9 +3136,18 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_bgwriter</structname> + + + pg_stat_bgwriter + + - The pg_stat_archiver view will always have a - single row, containing data about the archiver process of the cluster. + The pg_stat_bgwriter view will always have a + single row, containing global data for the cluster. @@ -3181,9 +3273,19 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_database</structname> + + + pg_stat_database + + - The pg_stat_bgwriter view will always have a - single row, containing global data for the cluster. + The pg_stat_database view will contain one row + for each database in the cluster, plus one for shared objects, showing + database-wide statistics. @@ -3325,7 +3427,8 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i Number of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see - for details.) + + pg_stat_database_conflicts for details.) @@ -3418,10 +3521,21 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_database_conflicts</structname> + + + pg_stat_database_conflicts + + - 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_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. @@ -3510,12 +3624,23 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_all_tables</structname> + + + pg_stat_all_tables + + - 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. + 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. @@ -3750,14 +3875,23 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_all_indexes</structname> + + + pg_stat_all_indexes + + - 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 + 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 tables respectively. + but filtered to only show user and system indexes respectively. @@ -3851,16 +3985,6 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
- - 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. - - Indexes can be used by simple index scans, bitmap index scans, and the optimizer. In a bitmap scan @@ -3890,6 +4014,25 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i +
+ + + <structname>pg_statio_all_tables</structname> + + + pg_statio_all_tables + + + + 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_statio_all_tables</structname> View @@ -4007,96 +4150,14 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
- - 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_statio_all_indexes</structname> View - - - - - Column Type - - - Description - - - + + <structname>pg_statio_all_indexes</structname> - - - - relid oid - - - OID of the table for this index - - - - - - indexrelid oid - - - OID of this index - - - - - - schemaname name - - - Name of the schema this index is in - - - - - - relname name - - - Name of the table for this index - - - - - - indexrelname name - - - Name of this index - - - - - - idx_blks_read bigint - - - Number of disk blocks read from this index - - - - - - idx_blks_hit bigint - - - Number of buffer hits in this index - - - - -
+ + pg_statio_all_indexes + The pg_statio_all_indexes view will contain @@ -4108,6 +4169,102 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i but filtered to only show user and system indexes respectively. + + <structname>pg_statio_all_indexes</structname> View + + + + + Column Type + + + Description + + + + + + + + relid oid + + + OID of the table for this index + + + + + + indexrelid oid + + + OID of this index + + + + + + schemaname name + + + Name of the schema this index is in + + + + + + relname name + + + Name of the table for this index + + + + + + indexrelname name + + + Name of this index + + + + + + idx_blks_read bigint + + + Number of disk blocks read from this index + + + + + + idx_blks_hit bigint + + + Number of buffer hits in this index + + + + +
+ + + + + <structname>pg_statio_all_sequences</structname> + + + pg_statio_all_sequences + + + + 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. + + <structname>pg_statio_all_sequences</structname> View @@ -4171,10 +4328,20 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_user_functions</structname> + + + pg_stat_user_functions + + - 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. + 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. @@ -4251,10 +4418,19 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
+
+ + + <structname>pg_stat_slru</structname> + SLRU + + pg_stat_slru + + PostgreSQL accesses certain on-disk information via SLRU (simple least-recently-used) caches. @@ -4364,13 +4540,6 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i - - 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. - - diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml index a04a180165..63e148833f 100644 --- a/doc/src/sgml/ref/initdb.sgml +++ b/doc/src/sgml/ref/initdb.sgml @@ -219,7 +219,8 @@ PostgreSQL documentation may incur a noticeable performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the - view. + + pg_stat_database view.
diff --git a/doc/src/sgml/ref/pg_basebackup.sgml b/doc/src/sgml/ref/pg_basebackup.sgml index 12fadabfb8..d31fb1ce92 100644 --- a/doc/src/sgml/ref/pg_basebackup.sgml +++ b/doc/src/sgml/ref/pg_basebackup.sgml @@ -533,7 +533,8 @@ PostgreSQL documentation in a non-zero exit status. However, the base backup will not be removed in such a case, as if the option had been used. Checksum verifications failures will also be reported - in the view. + in the + pg_stat_database view. diff --git a/doc/src/sgml/sslinfo.sgml b/doc/src/sgml/sslinfo.sgml index 78ff83d642..c237d4ba95 100644 --- a/doc/src/sgml/sslinfo.sgml +++ b/doc/src/sgml/sslinfo.sgml @@ -16,7 +16,8 @@ Some of the information available through this module can also be obtained - using the built-in system view . + using the built-in system view + pg_stat_ssl.