mirror of
https://github.com/postgres/postgres.git
synced 2025-12-24 06:01:07 +03:00
Add views and functions to monitor hot standby query conflicts
Add the view pg_stat_database_conflicts and a column to pg_stat_database, and the underlying functions to provide the information.
This commit is contained in:
@@ -1554,6 +1554,13 @@ if (!triggered)
|
||||
approach, since <varname>vacuum_defer_cleanup_age</> is measured in
|
||||
transactions executed on the primary server.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The number of query cancels and the reason for them can be viewed using
|
||||
the <structname>pg_stat_database_conflicts</> system view on the standby
|
||||
server. The <structname>pg_stat_database</> system view also contains
|
||||
summary information.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="hot-standby-admin">
|
||||
|
||||
@@ -278,7 +278,19 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
|
||||
number of transactions committed and rolled back in that database,
|
||||
total disk blocks read, total buffer hits (i.e., block
|
||||
read requests avoided by finding the block already in buffer cache),
|
||||
number of rows returned, fetched, inserted, updated and deleted.
|
||||
number of rows returned, fetched, inserted, updated and deleted, and
|
||||
total number of queries cancelled due to conflict with recovery (on
|
||||
standby servers).
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><structname>pg_stat_database_conflicts</><indexterm><primary>pg_stat_database_conflicts</primary></indexterm></entry>
|
||||
<entry>One row per database, showing database OID, database name and
|
||||
the number of queries that have been cancelled in this database due to
|
||||
dropped tablespaces, lock timeouts, old snapshots, pinned buffers and
|
||||
deadlocks. Will only contain information on standby servers, since
|
||||
conflicts do not occur on master servers.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
@@ -599,6 +611,46 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal><function>pg_stat_get_db_conflict_tablespace</function>(<type>oid</type>)</literal></entry>
|
||||
<entry><type>bigint</type></entry>
|
||||
<entry>
|
||||
Number of queries cancelled because of recovery conflict with dropped tablespaces in database
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal><function>pg_stat_get_db_conflict_lock</function>(<type>oid</type>)</literal></entry>
|
||||
<entry><type>bigint</type></entry>
|
||||
<entry>
|
||||
Number of queries cancelled because of recovery conflict with locks in database
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal><function>pg_stat_get_db_conflict_snapshot</function>(<type>oid</type>)</literal></entry>
|
||||
<entry><type>bigint</type></entry>
|
||||
<entry>
|
||||
Number of queries cancelled because of recovery conflict with old snapshots in database
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal><function>pg_stat_get_db_conflict_bufferpin</function>(<type>oid</type>)</literal></entry>
|
||||
<entry><type>bigint</type></entry>
|
||||
<entry>
|
||||
Number of queries cancelled because of recovery conflict with pinned buffers in database
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal><function>pg_stat_get_db_conflict_startup_deadlock</function>(<type>oid</type>)</literal></entry>
|
||||
<entry><type>bigint</type></entry>
|
||||
<entry>
|
||||
Number of queries cancelled because of recovery conflict with deadlocks in database
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal><function>pg_stat_get_numscans</function>(<type>oid</type>)</literal></entry>
|
||||
<entry><type>bigint</type></entry>
|
||||
|
||||
Reference in New Issue
Block a user