From 77bd49adba4711b4497e7e39a5ec3a9812cbd52a Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Fri, 12 Apr 2019 14:04:50 +0200 Subject: Show shared object statistics in pg_stat_database This adds a row to the pg_stat_database view with datoid 0 and datname NULL for those objects that are not in a database. This was added particularly for checksums, but we were already tracking more satistics for these objects, just not returning it. Also add a checksum_last_failure column that holds the timestamptz of the last checksum failure that occurred in a database (or in a non-dataabase file), if any. Author: Julien Rouhaud --- doc/src/sgml/monitoring.sgml | 26 ++++++++++++++++++-------- doc/src/sgml/ref/initdb.sgml | 4 +++- doc/src/sgml/ref/pg_basebackup.sgml | 3 ++- 3 files changed, 23 insertions(+), 10 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 9cc332b6ad1..547fe4cce93 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -2498,20 +2498,22 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i datid oid - OID of a database + OID of this database, or 0 for objects belonging to a shared + relation datname name - Name of this database + Name of this database, or NULL for the shared + objects. numbackends integer - 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. + Number of backends currently connected to this database, or + NULL for the 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 @@ -2597,7 +2599,14 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i checksum_failures bigint - Number of data page checksum failures detected in this database + Number of data page checksum failures detected in this + database + + + 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. blk_read_time @@ -2622,7 +2631,8 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i The pg_stat_database view will contain one row - for each database in the cluster, showing database-wide statistics. + for each database in the cluster, plus one for the shared objects, showing + database-wide statistics. diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml index 7f323103084..7fc3152c6d3 100644 --- a/doc/src/sgml/ref/initdb.sgml +++ b/doc/src/sgml/ref/initdb.sgml @@ -218,7 +218,9 @@ PostgreSQL documentation I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If - set, checksums are calculated for all objects, in all databases. + set, checksums are calculated for all objects, in all databases. All + checksum failures will be reported in the view. diff --git a/doc/src/sgml/ref/pg_basebackup.sgml b/doc/src/sgml/ref/pg_basebackup.sgml index 830e87fc6ae..fc9e222f8d0 100644 --- a/doc/src/sgml/ref/pg_basebackup.sgml +++ b/doc/src/sgml/ref/pg_basebackup.sgml @@ -531,7 +531,8 @@ PostgreSQL documentation By default, checksums are verified and checksum failures will result 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. + had been used. Checksum verifications failures will also be reported + in the view. -- cgit v1.2.3