1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

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 <rjuju123@gmail.com>
This commit is contained in:
Magnus Hagander
2019-04-12 14:04:50 +02:00
parent ef6f30fe77
commit 77bd49adba
10 changed files with 76 additions and 17 deletions

View File

@@ -2498,20 +2498,22 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
<row>
<entry><structfield>datid</structfield></entry>
<entry><type>oid</type></entry>
<entry>OID of a database</entry>
<entry>OID of this database, or 0 for objects belonging to a shared
relation</entry>
</row>
<row>
<entry><structfield>datname</structfield></entry>
<entry><type>name</type></entry>
<entry>Name of this database</entry>
<entry>Name of this database, or <literal>NULL</literal> for the shared
objects.</entry>
</row>
<row>
<entry><structfield>numbackends</structfield></entry>
<entry><type>integer</type></entry>
<entry>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.</entry>
<entry>Number of backends currently connected to this database, or
<literal>NULL</literal> 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.</entry>
</row>
<row>
<entry><structfield>xact_commit</structfield></entry>
@@ -2597,7 +2599,14 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
<row>
<entry><structfield>checksum_failures</structfield></entry>
<entry><type>bigint</type></entry>
<entry>Number of data page checksum failures detected in this database</entry>
<entry>Number of data page checksum failures detected in this
database</entry>
</row>
<row>
<entry><structfield>checksum_last_failure</structfield></entry>
<entry><type>timestamp with time zone</type></entry>
<entry>Time at which the last data page checksum failure was detected in
this database, or on a shared object.</entry>
</row>
<row>
<entry><structfield>blk_read_time</structfield></entry>
@@ -2622,7 +2631,8 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
<para>
The <structname>pg_stat_database</structname> 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.
</para>
<table id="pg-stat-database-conflicts-view" xreflabel="pg_stat_database_conflicts">