mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +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:
@ -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">
|
||||
|
@ -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 <xref
|
||||
linkend="pg-stat-database-view"/> view.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -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>--no-clean</option> option
|
||||
had been used.
|
||||
had been used. Checksum verifications failures will also be reported
|
||||
in the <xref linkend="pg-stat-database-view"/> view.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
Reference in New Issue
Block a user