Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
monitoring-stats.html2796 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>28.2. The Cumulative Statistics System</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="monitoring-ps.html" title="28.1. Standard Unix Tools" /><link rel="next" href="monitoring-locks.html" title="28.3. Viewing Locks" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">28.2. The Cumulative Statistics System</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="monitoring-ps.html" title="28.1. Standard Unix Tools">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="monitoring.html" title="Chapter 28. Monitoring Database Activity">Up</a></td><th width="60%" align="center">Chapter 28. Monitoring Database Activity</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="monitoring-locks.html" title="28.3. Viewing Locks">Next</a></td></tr></table><hr /></div><div class="sect1" id="MONITORING-STATS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">28.2. The Cumulative Statistics System <a href="#MONITORING-STATS" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-STATS-SETUP">28.2.1. Statistics Collection Configuration</a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-STATS-VIEWS">28.2.2. Viewing Statistics</a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW">28.2.3. <code class="structname">pg_stat_activity</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-REPLICATION-VIEW">28.2.4. <code class="structname">pg_stat_replication</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-REPLICATION-SLOTS-VIEW">28.2.5. <code class="structname">pg_stat_replication_slots</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-WAL-RECEIVER-VIEW">28.2.6. <code class="structname">pg_stat_wal_receiver</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-RECOVERY-PREFETCH">28.2.7. <code class="structname">pg_stat_recovery_prefetch</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION">28.2.8. <code class="structname">pg_stat_subscription</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION-STATS">28.2.9. <code class="structname">pg_stat_subscription_stats</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-SSL-VIEW">28.2.10. <code class="structname">pg_stat_ssl</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-GSSAPI-VIEW">28.2.11. <code class="structname">pg_stat_gssapi</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-ARCHIVER-VIEW">28.2.12. <code class="structname">pg_stat_archiver</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-IO-VIEW">28.2.13. <code class="structname">pg_stat_io</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-BGWRITER-VIEW">28.2.14. <code class="structname">pg_stat_bgwriter</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-WAL-VIEW">28.2.15. <code class="structname">pg_stat_wal</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW">28.2.16. <code class="structname">pg_stat_database</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-DATABASE-CONFLICTS-VIEW">28.2.17. <code class="structname">pg_stat_database_conflicts</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW">28.2.18. <code class="structname">pg_stat_all_tables</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-ALL-INDEXES-VIEW">28.2.19. <code class="structname">pg_stat_all_indexes</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STATIO-ALL-TABLES-VIEW">28.2.20. <code class="structname">pg_statio_all_tables</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STATIO-ALL-INDEXES-VIEW">28.2.21. <code class="structname">pg_statio_all_indexes</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STATIO-ALL-SEQUENCES-VIEW">28.2.22. <code class="structname">pg_statio_all_sequences</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-USER-FUNCTIONS-VIEW">28.2.23. <code class="structname">pg_stat_user_functions</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-PG-STAT-SLRU-VIEW">28.2.24. <code class="structname">pg_stat_slru</code></a></span></dt><dt><span class="sect2"><a href="monitoring-stats.html#MONITORING-STATS-FUNCTIONS">28.2.25. Statistics Functions</a></span></dt></dl></div><a id="id-1.6.15.7.2" class="indexterm"></a><p>3   <span class="productname">PostgreSQL</span>'s <em class="firstterm">cumulative statistics4   system</em> supports collection and reporting of information about5   server activity.  Presently, accesses to tables and indexes in both6   disk-block and individual-row terms are counted.  The total number of rows7   in each table, and information about vacuum and analyze actions for each8   table are also counted.  If enabled, calls to user-defined functions and9   the total time spent in each one are counted as well.10  </p><p>11   <span class="productname">PostgreSQL</span> also supports reporting dynamic12   information about exactly what is going on in the system right now, such as13   the exact command currently being executed by other server processes, and14   which other connections exist in the system.  This facility is independent15   of the cumulative statistics system.16  </p><div class="sect2" id="MONITORING-STATS-SETUP"><div class="titlepage"><div><div><h3 class="title">28.2.1. Statistics Collection Configuration <a href="#MONITORING-STATS-SETUP" class="id_link">#</a></h3></div></div></div><p>17   Since collection of statistics adds some overhead to query execution,18   the system can be configured to collect or not collect information.19   This is controlled by configuration parameters that are normally set in20   <code class="filename">postgresql.conf</code>.  (See <a class="xref" href="runtime-config.html" title="Chapter 20. Server Configuration">Chapter 20</a> for21   details about setting configuration parameters.)22  </p><p>23   The parameter <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-ACTIVITIES">track_activities</a> enables monitoring24   of the current command being executed by any server process.25  </p><p>26   The parameter <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-COUNTS">track_counts</a> controls whether27   cumulative statistics are collected about table and index accesses.28  </p><p>29   The parameter <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-FUNCTIONS">track_functions</a> enables tracking of30   usage of user-defined functions.31  </p><p>32   The parameter <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-IO-TIMING">track_io_timing</a> enables monitoring33   of block read and write times.34  </p><p>35   The parameter <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-WAL-IO-TIMING">track_wal_io_timing</a> enables monitoring36   of WAL write times.37  </p><p>38   Normally these parameters are set in <code class="filename">postgresql.conf</code> so39   that they apply to all server processes, but it is possible to turn40   them on or off in individual sessions using the <a class="xref" href="sql-set.html" title="SET"><span class="refentrytitle">SET</span></a> command. (To prevent41   ordinary users from hiding their activity from the administrator,42   only superusers are allowed to change these parameters with43   <code class="command">SET</code>.)44  </p><p>45   Cumulative statistics are collected in shared memory. Every46   <span class="productname">PostgreSQL</span> process collects statistics locally,47   then updates the shared data at appropriate intervals.  When a server,48   including a physical replica, shuts down cleanly, a permanent copy of the49   statistics data is stored in the <code class="filename">pg_stat</code> subdirectory,50   so that statistics can be retained across server restarts.  In contrast,51   when starting from an unclean shutdown (e.g., after an immediate shutdown,52   a server crash, starting from a base backup, and point-in-time recovery),53   all statistics counters are reset.54  </p></div><div class="sect2" id="MONITORING-STATS-VIEWS"><div class="titlepage"><div><div><h3 class="title">28.2.2. Viewing Statistics <a href="#MONITORING-STATS-VIEWS" class="id_link">#</a></h3></div></div></div><p>55   Several predefined views, listed in <a class="xref" href="monitoring-stats.html#MONITORING-STATS-DYNAMIC-VIEWS-TABLE" title="Table 28.1. Dynamic Statistics Views">Table 28.1</a>, are available to show56   the current state of the system. There are also several other57   views, listed in <a class="xref" href="monitoring-stats.html#MONITORING-STATS-VIEWS-TABLE" title="Table 28.2. Collected Statistics Views">Table 28.2</a>, available to show the accumulated58   statistics.  Alternatively, one can59   build custom views using the underlying cumulative statistics functions, as60   discussed in <a class="xref" href="monitoring-stats.html#MONITORING-STATS-FUNCTIONS" title="28.2.25. Statistics Functions">Section 28.2.25</a>.61  </p><p>62   When using the cumulative statistics views and functions to monitor63   collected data, it is important to realize that the information does not64   update instantaneously.  Each individual server process flushes out65   accumulated statistics to shared memory just before going idle, but not66   more frequently than once per <code class="varname">PGSTAT_MIN_INTERVAL</code>67   milliseconds (1 second unless altered while building the server); so a68   query or transaction still in progress does not affect the displayed totals69   and the displayed information lags behind actual activity.  However,70   current-query information collected by <code class="varname">track_activities</code>71   is always up-to-date.72  </p><p>73   Another important point is that when a server process is asked to display74   any of the accumulated statistics, accessed values are cached until the end75   of its current transaction in the default configuration. So the statistics76   will show static information as long as you continue the current77   transaction. Similarly, information about the current queries of all78   sessions is collected when any such information is first requested within a79   transaction, and the same information will be displayed throughout the80   transaction. This is a feature, not a bug, because it allows you to perform81   several queries on the statistics and correlate the results without82   worrying that the numbers are changing underneath you.83 84   When analyzing statistics interactively, or with expensive queries, the85   time delta between accesses to individual statistics can lead to86   significant skew in the cached statistics. To minimize skew,87   <code class="varname">stats_fetch_consistency</code> can be set to88   <code class="literal">snapshot</code>, at the price of increased memory usage for89   caching not-needed statistics data.  Conversely, if it's known that90   statistics are only accessed once, caching accessed statistics is91   unnecessary and can be avoided by setting92   <code class="varname">stats_fetch_consistency</code> to <code class="literal">none</code>.93 94   You can invoke <code class="function">pg_stat_clear_snapshot</code>() to discard the95   current transaction's statistics snapshot or cached values (if any).  The96   next use of statistical information will (when in snapshot mode) cause a97   new snapshot to be built or (when in cache mode) accessed statistics to be98   cached.99  </p><p>100   A transaction can also see its own statistics (not yet flushed out to the101   shared memory statistics) in the views102   <code class="structname">pg_stat_xact_all_tables</code>,103   <code class="structname">pg_stat_xact_sys_tables</code>,104   <code class="structname">pg_stat_xact_user_tables</code>, and105   <code class="structname">pg_stat_xact_user_functions</code>.  These numbers do not act as106   stated above; instead they update continuously throughout the transaction.107  </p><p>108   Some of the information in the dynamic statistics views shown in <a class="xref" href="monitoring-stats.html#MONITORING-STATS-DYNAMIC-VIEWS-TABLE" title="Table 28.1. Dynamic Statistics Views">Table 28.1</a> is security restricted.109   Ordinary users can only see all the information about their own sessions110   (sessions belonging to a role that they are a member of).  In rows about111   other sessions, many columns will be null.  Note, however, that the112   existence of a session and its general properties such as its sessions user113   and database are visible to all users.  Superusers and roles with privileges of114   built-in role <code class="literal">pg_read_all_stats</code> (see also <a class="xref" href="predefined-roles.html" title="22.5. Predefined Roles">Section 22.5</a>) can see all the information about all sessions.115  </p><div class="table" id="MONITORING-STATS-DYNAMIC-VIEWS-TABLE"><p class="title"><strong>Table 28.1. Dynamic Statistics Views</strong></p><div class="table-contents"><table class="table" summary="Dynamic Statistics Views" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>View Name</th><th>Description</th></tr></thead><tbody><tr><td>116       <code class="structname">pg_stat_activity</code>117       <a id="id-1.6.15.7.6.7.2.2.1.1.2" class="indexterm"></a>118      </td><td>119       One row per server process, showing information related to120       the current activity of that process, such as state and current query.121       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW" title="28.2.3. pg_stat_activity">122       <code class="structname">pg_stat_activity</code></a> for details.123      </td></tr><tr><td><code class="structname">pg_stat_replication</code><a id="id-1.6.15.7.6.7.2.2.2.1.2" class="indexterm"></a></td><td>One row per WAL sender process, showing statistics about124       replication to that sender's connected standby server.125       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-REPLICATION-VIEW" title="28.2.4. pg_stat_replication">126       <code class="structname">pg_stat_replication</code></a> for details.127      </td></tr><tr><td><code class="structname">pg_stat_wal_receiver</code><a id="id-1.6.15.7.6.7.2.2.3.1.2" class="indexterm"></a></td><td>Only one row, showing statistics about the WAL receiver from128       that receiver's connected server.129       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-WAL-RECEIVER-VIEW" title="28.2.6. pg_stat_wal_receiver">130       <code class="structname">pg_stat_wal_receiver</code></a> for details.131      </td></tr><tr><td><code class="structname">pg_stat_recovery_prefetch</code><a id="id-1.6.15.7.6.7.2.2.4.1.2" class="indexterm"></a></td><td>Only one row, showing statistics about blocks prefetched during recovery.132       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-RECOVERY-PREFETCH" title="28.2.7. pg_stat_recovery_prefetch">133       <code class="structname">pg_stat_recovery_prefetch</code></a> for details.134      </td></tr><tr><td><code class="structname">pg_stat_subscription</code><a id="id-1.6.15.7.6.7.2.2.5.1.2" class="indexterm"></a></td><td>At least one row per subscription, showing information about135       the subscription workers.136       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION" title="28.2.8. pg_stat_subscription">137       <code class="structname">pg_stat_subscription</code></a> for details.138      </td></tr><tr><td><code class="structname">pg_stat_ssl</code><a id="id-1.6.15.7.6.7.2.2.6.1.2" class="indexterm"></a></td><td>One row per connection (regular and replication), showing information about139       SSL used on this connection.140       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-SSL-VIEW" title="28.2.10. pg_stat_ssl">141       <code class="structname">pg_stat_ssl</code></a> for details.142      </td></tr><tr><td><code class="structname">pg_stat_gssapi</code><a id="id-1.6.15.7.6.7.2.2.7.1.2" class="indexterm"></a></td><td>One row per connection (regular and replication), showing information about143       GSSAPI authentication and encryption used on this connection.144       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-GSSAPI-VIEW" title="28.2.11. pg_stat_gssapi">145       <code class="structname">pg_stat_gssapi</code></a> for details.146      </td></tr><tr><td><code class="structname">pg_stat_progress_analyze</code><a id="id-1.6.15.7.6.7.2.2.8.1.2" class="indexterm"></a></td><td>One row for each backend (including autovacuum worker processes) running147       <code class="command">ANALYZE</code>, showing current progress.148       See <a class="xref" href="progress-reporting.html#ANALYZE-PROGRESS-REPORTING" title="28.4.1. ANALYZE Progress Reporting">Section 28.4.1</a>.149      </td></tr><tr><td><code class="structname">pg_stat_progress_create_index</code><a id="id-1.6.15.7.6.7.2.2.9.1.2" class="indexterm"></a></td><td>One row for each backend running <code class="command">CREATE INDEX</code> or <code class="command">REINDEX</code>, showing150      current progress.151      See <a class="xref" href="progress-reporting.html#CREATE-INDEX-PROGRESS-REPORTING" title="28.4.4. CREATE INDEX Progress Reporting">Section 28.4.4</a>.152     </td></tr><tr><td><code class="structname">pg_stat_progress_vacuum</code><a id="id-1.6.15.7.6.7.2.2.10.1.2" class="indexterm"></a></td><td>One row for each backend (including autovacuum worker processes) running153       <code class="command">VACUUM</code>, showing current progress.154       See <a class="xref" href="progress-reporting.html#VACUUM-PROGRESS-REPORTING" title="28.4.5. VACUUM Progress Reporting">Section 28.4.5</a>.155      </td></tr><tr><td><code class="structname">pg_stat_progress_cluster</code><a id="id-1.6.15.7.6.7.2.2.11.1.2" class="indexterm"></a></td><td>One row for each backend running156       <code class="command">CLUSTER</code> or <code class="command">VACUUM FULL</code>, showing current progress.157       See <a class="xref" href="progress-reporting.html#CLUSTER-PROGRESS-REPORTING" title="28.4.2. CLUSTER Progress Reporting">Section 28.4.2</a>.158      </td></tr><tr><td><code class="structname">pg_stat_progress_basebackup</code><a id="id-1.6.15.7.6.7.2.2.12.1.2" class="indexterm"></a></td><td>One row for each WAL sender process streaming a base backup,159       showing current progress.160       See <a class="xref" href="progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING" title="28.4.6. Base Backup Progress Reporting">Section 28.4.6</a>.161      </td></tr><tr><td><code class="structname">pg_stat_progress_copy</code><a id="id-1.6.15.7.6.7.2.2.13.1.2" class="indexterm"></a></td><td>One row for each backend running <code class="command">COPY</code>, showing current progress.162       See <a class="xref" href="progress-reporting.html#COPY-PROGRESS-REPORTING" title="28.4.3. COPY Progress Reporting">Section 28.4.3</a>.163      </td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="MONITORING-STATS-VIEWS-TABLE"><p class="title"><strong>Table 28.2. Collected Statistics Views</strong></p><div class="table-contents"><table class="table" summary="Collected Statistics Views" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>View Name</th><th>Description</th></tr></thead><tbody><tr><td><code class="structname">pg_stat_archiver</code><a id="id-1.6.15.7.6.8.2.2.1.1.2" class="indexterm"></a></td><td>One row only, showing statistics about the164       WAL archiver process's activity. See165       <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-ARCHIVER-VIEW" title="28.2.12. pg_stat_archiver">166       <code class="structname">pg_stat_archiver</code></a> for details.167      </td></tr><tr><td><code class="structname">pg_stat_bgwriter</code><a id="id-1.6.15.7.6.8.2.2.2.1.2" class="indexterm"></a></td><td>One row only, showing statistics about the168       background writer process's activity. See169       <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-BGWRITER-VIEW" title="28.2.14. pg_stat_bgwriter">170       <code class="structname">pg_stat_bgwriter</code></a> for details.171     </td></tr><tr><td><code class="structname">pg_stat_database</code><a id="id-1.6.15.7.6.8.2.2.3.1.2" class="indexterm"></a></td><td>One row per database, showing database-wide statistics. See172       <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW" title="28.2.16. pg_stat_database">173       <code class="structname">pg_stat_database</code></a> for details.174      </td></tr><tr><td><code class="structname">pg_stat_database_conflicts</code><a id="id-1.6.15.7.6.8.2.2.4.1.2" class="indexterm"></a></td><td>175       One row per database, showing database-wide statistics about176       query cancels due to conflict with recovery on standby servers.177       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-DATABASE-CONFLICTS-VIEW" title="28.2.17. pg_stat_database_conflicts">178       <code class="structname">pg_stat_database_conflicts</code></a> for details.179      </td></tr><tr><td><code class="structname">pg_stat_io</code><a id="id-1.6.15.7.6.8.2.2.5.1.2" class="indexterm"></a></td><td>180       One row for each combination of backend type, context, and target object181       containing cluster-wide I/O statistics.182       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-IO-VIEW" title="28.2.13. pg_stat_io">183       <code class="structname">pg_stat_io</code></a> for details.184     </td></tr><tr><td><code class="structname">pg_stat_replication_slots</code><a id="id-1.6.15.7.6.8.2.2.6.1.2" class="indexterm"></a></td><td>One row per replication slot, showing statistics about the185       replication slot's usage. See186       <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-REPLICATION-SLOTS-VIEW" title="28.2.5. pg_stat_replication_slots">187       <code class="structname">pg_stat_replication_slots</code></a> for details.188      </td></tr><tr><td><code class="structname">pg_stat_slru</code><a id="id-1.6.15.7.6.8.2.2.7.1.2" class="indexterm"></a></td><td>One row per SLRU, showing statistics of operations. See189       <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-SLRU-VIEW" title="28.2.24. pg_stat_slru">190       <code class="structname">pg_stat_slru</code></a> for details.191      </td></tr><tr><td><code class="structname">pg_stat_subscription_stats</code><a id="id-1.6.15.7.6.8.2.2.8.1.2" class="indexterm"></a></td><td>One row per subscription, showing statistics about errors.192      See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION-STATS" title="28.2.9. pg_stat_subscription_stats">193      <code class="structname">pg_stat_subscription_stats</code></a> for details.194      </td></tr><tr><td><code class="structname">pg_stat_wal</code><a id="id-1.6.15.7.6.8.2.2.9.1.2" class="indexterm"></a></td><td>One row only, showing statistics about WAL activity. See195       <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-WAL-VIEW" title="28.2.15. pg_stat_wal">196       <code class="structname">pg_stat_wal</code></a> for details.197      </td></tr><tr><td><code class="structname">pg_stat_all_tables</code><a id="id-1.6.15.7.6.8.2.2.10.1.2" class="indexterm"></a></td><td>198       One row for each table in the current database, showing statistics199       about accesses to that specific table.200       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW" title="28.2.18. pg_stat_all_tables">201       <code class="structname">pg_stat_all_tables</code></a> for details.202      </td></tr><tr><td><code class="structname">pg_stat_sys_tables</code><a id="id-1.6.15.7.6.8.2.2.11.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_stat_all_tables</code>, except that only203      system tables are shown.</td></tr><tr><td><code class="structname">pg_stat_user_tables</code><a id="id-1.6.15.7.6.8.2.2.12.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_stat_all_tables</code>, except that only user204      tables are shown.</td></tr><tr><td><code class="structname">pg_stat_xact_all_tables</code><a id="id-1.6.15.7.6.8.2.2.13.1.2" class="indexterm"></a></td><td>Similar to <code class="structname">pg_stat_all_tables</code>, but counts actions205      taken so far within the current transaction (which are <span class="emphasis"><em>not</em></span>206      yet included in <code class="structname">pg_stat_all_tables</code> and related views).207      The columns for numbers of live and dead rows and vacuum and208      analyze actions are not present in this view.</td></tr><tr><td><code class="structname">pg_stat_xact_sys_tables</code><a id="id-1.6.15.7.6.8.2.2.14.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_stat_xact_all_tables</code>, except that only209      system tables are shown.</td></tr><tr><td><code class="structname">pg_stat_xact_user_tables</code><a id="id-1.6.15.7.6.8.2.2.15.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_stat_xact_all_tables</code>, except that only210      user tables are shown.</td></tr><tr><td><code class="structname">pg_stat_all_indexes</code><a id="id-1.6.15.7.6.8.2.2.16.1.2" class="indexterm"></a></td><td>211       One row for each index in the current database, showing statistics212       about accesses to that specific index.213       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-ALL-INDEXES-VIEW" title="28.2.19. pg_stat_all_indexes">214       <code class="structname">pg_stat_all_indexes</code></a> for details.215      </td></tr><tr><td><code class="structname">pg_stat_sys_indexes</code><a id="id-1.6.15.7.6.8.2.2.17.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_stat_all_indexes</code>, except that only216      indexes on system tables are shown.</td></tr><tr><td><code class="structname">pg_stat_user_indexes</code><a id="id-1.6.15.7.6.8.2.2.18.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_stat_all_indexes</code>, except that only217      indexes on user tables are shown.</td></tr><tr><td><code class="structname">pg_stat_user_functions</code><a id="id-1.6.15.7.6.8.2.2.19.1.2" class="indexterm"></a></td><td>218       One row for each tracked function, showing statistics219       about executions of that function. See220       <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-USER-FUNCTIONS-VIEW" title="28.2.23. pg_stat_user_functions">221       <code class="structname">pg_stat_user_functions</code></a> for details.222      </td></tr><tr><td><code class="structname">pg_stat_xact_user_functions</code><a id="id-1.6.15.7.6.8.2.2.20.1.2" class="indexterm"></a></td><td>Similar to <code class="structname">pg_stat_user_functions</code>, but counts only223      calls during the current transaction (which are <span class="emphasis"><em>not</em></span>224      yet included in <code class="structname">pg_stat_user_functions</code>).</td></tr><tr><td><code class="structname">pg_statio_all_tables</code><a id="id-1.6.15.7.6.8.2.2.21.1.2" class="indexterm"></a></td><td>225       One row for each table in the current database, showing statistics226       about I/O on that specific table.227       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STATIO-ALL-TABLES-VIEW" title="28.2.20. pg_statio_all_tables">228       <code class="structname">pg_statio_all_tables</code></a> for details.229      </td></tr><tr><td><code class="structname">pg_statio_sys_tables</code><a id="id-1.6.15.7.6.8.2.2.22.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_statio_all_tables</code>, except that only230      system tables are shown.</td></tr><tr><td><code class="structname">pg_statio_user_tables</code><a id="id-1.6.15.7.6.8.2.2.23.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_statio_all_tables</code>, except that only231      user tables are shown.</td></tr><tr><td><code class="structname">pg_statio_all_indexes</code><a id="id-1.6.15.7.6.8.2.2.24.1.2" class="indexterm"></a></td><td>232       One row for each index in the current database,233       showing statistics about I/O on that specific index.234       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STATIO-ALL-INDEXES-VIEW" title="28.2.21. pg_statio_all_indexes">235       <code class="structname">pg_statio_all_indexes</code></a> for details.236      </td></tr><tr><td><code class="structname">pg_statio_sys_indexes</code><a id="id-1.6.15.7.6.8.2.2.25.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_statio_all_indexes</code>, except that only237      indexes on system tables are shown.</td></tr><tr><td><code class="structname">pg_statio_user_indexes</code><a id="id-1.6.15.7.6.8.2.2.26.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_statio_all_indexes</code>, except that only238      indexes on user tables are shown.</td></tr><tr><td><code class="structname">pg_statio_all_sequences</code><a id="id-1.6.15.7.6.8.2.2.27.1.2" class="indexterm"></a></td><td>239       One row for each sequence in the current database,240       showing statistics about I/O on that specific sequence.241       See <a class="link" href="monitoring-stats.html#MONITORING-PG-STATIO-ALL-SEQUENCES-VIEW" title="28.2.22. pg_statio_all_sequences">242       <code class="structname">pg_statio_all_sequences</code></a> for details.243     </td></tr><tr><td><code class="structname">pg_statio_sys_sequences</code><a id="id-1.6.15.7.6.8.2.2.28.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_statio_all_sequences</code>, except that only244      system sequences are shown.  (Presently, no system sequences are defined,245      so this view is always empty.)</td></tr><tr><td><code class="structname">pg_statio_user_sequences</code><a id="id-1.6.15.7.6.8.2.2.29.1.2" class="indexterm"></a></td><td>Same as <code class="structname">pg_statio_all_sequences</code>, except that only246      user sequences are shown.</td></tr></tbody></table></div></div><br class="table-break" /><p>247   The per-index statistics are particularly useful to determine which248   indexes are being used and how effective they are.249  </p><p>250   The <code class="structname">pg_stat_io</code> and251   <code class="structname">pg_statio_</code> set of views are useful for determining252   the effectiveness of the buffer cache. They can be used to calculate a cache253   hit ratio. Note that while <span class="productname">PostgreSQL</span>'s I/O254   statistics capture most instances in which the kernel was invoked in order255   to perform I/O, they do not differentiate between data which had to be256   fetched from disk and that which already resided in the kernel page cache.257   Users are advised to use the <span class="productname">PostgreSQL</span>258   statistics views in combination with operating system utilities for a more259   complete picture of their database's I/O performance.260  </p></div><div class="sect2" id="MONITORING-PG-STAT-ACTIVITY-VIEW"><div class="titlepage"><div><div><h3 class="title">28.2.3. <code class="structname">pg_stat_activity</code> <a href="#MONITORING-PG-STAT-ACTIVITY-VIEW" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.7.2" class="indexterm"></a><p>261   The <code class="structname">pg_stat_activity</code> view will have one row262   per server process, showing information related to263   the current activity of that process.264  </p><div class="table" id="PG-STAT-ACTIVITY-VIEW"><p class="title"><strong>Table 28.3. <code class="structname">pg_stat_activity</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_activity View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">265       Column Type266      </p>267      <p>268       Description269      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">270       <code class="structfield">datid</code> <code class="type">oid</code>271      </p>272      <p>273       OID of the database this backend is connected to274      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">275       <code class="structfield">datname</code> <code class="type">name</code>276      </p>277      <p>278       Name of the database this backend is connected to279      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">280       <code class="structfield">pid</code> <code class="type">integer</code>281      </p>282      <p>283       Process ID of this backend284      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">285       <code class="structfield">leader_pid</code> <code class="type">integer</code>286      </p>287      <p>288       Process ID of the parallel group leader if this process is a parallel289       query worker, or process ID of the leader apply worker if this process290       is a parallel apply worker.  <code class="literal">NULL</code> indicates that this291       process is a parallel group leader or leader apply worker, or does not292       participate in any parallel operation.293      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">294       <code class="structfield">usesysid</code> <code class="type">oid</code>295      </p>296      <p>297       OID of the user logged into this backend298      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">299       <code class="structfield">usename</code> <code class="type">name</code>300      </p>301      <p>302       Name of the user logged into this backend303      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">304       <code class="structfield">application_name</code> <code class="type">text</code>305      </p>306      <p>307       Name of the application that is connected308       to this backend309      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">310       <code class="structfield">client_addr</code> <code class="type">inet</code>311      </p>312      <p>313       IP address of the client connected to this backend.314       If this field is null, it indicates either that the client is315       connected via a Unix socket on the server machine or that this is an316       internal process such as autovacuum.317      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">318       <code class="structfield">client_hostname</code> <code class="type">text</code>319      </p>320      <p>321       Host name of the connected client, as reported by a322       reverse DNS lookup of <code class="structfield">client_addr</code>. This field will323       only be non-null for IP connections, and only when <a class="xref" href="runtime-config-logging.html#GUC-LOG-HOSTNAME">log_hostname</a> is enabled.324      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">325       <code class="structfield">client_port</code> <code class="type">integer</code>326      </p>327      <p>328       TCP port number that the client is using for communication329       with this backend, or <code class="literal">-1</code> if a Unix socket is used.330       If this field is null, it indicates that this is an internal server process.331      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">332       <code class="structfield">backend_start</code> <code class="type">timestamp with time zone</code>333      </p>334      <p>335       Time when this process was started.  For client backends,336       this is the time the client connected to the server.337      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">338       <code class="structfield">xact_start</code> <code class="type">timestamp with time zone</code>339      </p>340      <p>341       Time when this process' current transaction was started, or null342       if no transaction is active. If the current343       query is the first of its transaction, this column is equal to the344       <code class="structfield">query_start</code> column.345      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">346       <code class="structfield">query_start</code> <code class="type">timestamp with time zone</code>347      </p>348      <p>349       Time when the currently active query was started, or if350       <code class="structfield">state</code> is not <code class="literal">active</code>, when the last query351       was started352      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">353       <code class="structfield">state_change</code> <code class="type">timestamp with time zone</code>354      </p>355      <p>356       Time when the <code class="structfield">state</code> was last changed357      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">358       <code class="structfield">wait_event_type</code> <code class="type">text</code>359      </p>360      <p>361       The type of event for which the backend is waiting, if any;362       otherwise NULL.  See <a class="xref" href="monitoring-stats.html#WAIT-EVENT-TABLE" title="Table 28.4. Wait Event Types">Table 28.4</a>.363      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">364       <code class="structfield">wait_event</code> <code class="type">text</code>365      </p>366      <p>367       Wait event name if backend is currently waiting, otherwise NULL.368       See <a class="xref" href="monitoring-stats.html#WAIT-EVENT-ACTIVITY-TABLE" title="Table 28.5. Wait Events of Type Activity">Table 28.5</a> through369       <a class="xref" href="monitoring-stats.html#WAIT-EVENT-TIMEOUT-TABLE" title="Table 28.13. Wait Events of Type Timeout">Table 28.13</a>.370      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">371       <code class="structfield">state</code> <code class="type">text</code>372      </p>373      <p>374       Current overall state of this backend.375       Possible values are:376       </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>377          <code class="literal">active</code>: The backend is executing a query.378         </p></li><li class="listitem"><p>379          <code class="literal">idle</code>: The backend is waiting for a new client command.380         </p></li><li class="listitem"><p>381          <code class="literal">idle in transaction</code>: The backend is in a transaction,382          but is not currently executing a query.383         </p></li><li class="listitem"><p>384          <code class="literal">idle in transaction (aborted)</code>: This state is similar to385          <code class="literal">idle in transaction</code>, except one of the statements in386          the transaction caused an error.387         </p></li><li class="listitem"><p>388          <code class="literal">fastpath function call</code>: The backend is executing a389          fast-path function.390         </p></li><li class="listitem"><p>391          <code class="literal">disabled</code>: This state is reported if <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-ACTIVITIES">track_activities</a> is disabled in this backend.392         </p></li></ul></div><p>393      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">394       <code class="structfield">backend_xid</code> <code class="type">xid</code>395      </p>396      <p>397       Top-level transaction identifier of this backend, if any;  see398       <a class="xref" href="transaction-id.html" title="74.1. Transactions and Identifiers">Section 74.1</a>.399      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">400       <code class="structfield">backend_xmin</code> <code class="type">xid</code>401      </p>402      <p>403       The current backend's <code class="literal">xmin</code> horizon.404      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">405      <code class="structfield">query_id</code> <code class="type">bigint</code>406     </p>407     <p>408      Identifier of this backend's most recent query. If409      <code class="structfield">state</code> is <code class="literal">active</code> this410      field shows the identifier of the currently executing query. In411      all other states, it shows the identifier of last query that was412      executed.  Query identifiers are not computed by default so this413      field will be null unless <a class="xref" href="runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID">compute_query_id</a>414      parameter is enabled or a third-party module that computes query415      identifiers is configured.416     </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">417       <code class="structfield">query</code> <code class="type">text</code>418      </p>419      <p>420       Text of this backend's most recent query. If421       <code class="structfield">state</code> is <code class="literal">active</code> this field shows the422       currently executing query. In all other states, it shows the last query423       that was executed. By default the query text is truncated at 1024424       bytes; this value can be changed via the parameter425       <a class="xref" href="runtime-config-statistics.html#GUC-TRACK-ACTIVITY-QUERY-SIZE">track_activity_query_size</a>.426      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">427       <code class="structfield">backend_type</code> <code class="type">text</code>428      </p>429      <p>430       Type of current backend. Possible types are431       <code class="literal">autovacuum launcher</code>, <code class="literal">autovacuum worker</code>,432       <code class="literal">logical replication launcher</code>,433       <code class="literal">logical replication worker</code>,434       <code class="literal">parallel worker</code>, <code class="literal">background writer</code>,435       <code class="literal">client backend</code>, <code class="literal">checkpointer</code>,436       <code class="literal">archiver</code>, <code class="literal">standalone backend</code>,437       <code class="literal">startup</code>, <code class="literal">walreceiver</code>,438       <code class="literal">walsender</code> and <code class="literal">walwriter</code>.439       In addition, background workers registered by extensions may have440       additional types.441      </p></td></tr></tbody></table></div></div><br class="table-break" /><div class="note"><h3 class="title">Note</h3><p>442    The <code class="structfield">wait_event</code> and <code class="structfield">state</code> columns are443    independent.  If a backend is in the <code class="literal">active</code> state,444    it may or may not be <code class="literal">waiting</code> on some event.  If the state445    is <code class="literal">active</code> and <code class="structfield">wait_event</code> is non-null, it446    means that a query is being executed, but is being blocked somewhere447    in the system.448   </p></div><div class="table" id="WAIT-EVENT-TABLE"><p class="title"><strong>Table 28.4. Wait Event Types</strong></p><div class="table-contents"><table class="table" summary="Wait Event Types" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Wait Event Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">Activity</code></td><td>The server process is idle.  This event type indicates a process449       waiting for activity in its main processing loop.450       <code class="literal">wait_event</code> will identify the specific wait point;451       see <a class="xref" href="monitoring-stats.html#WAIT-EVENT-ACTIVITY-TABLE" title="Table 28.5. Wait Events of Type Activity">Table 28.5</a>.452      </td></tr><tr><td><code class="literal">BufferPin</code></td><td>The server process is waiting for exclusive access to453       a data buffer.  Buffer pin waits can be protracted if454       another process holds an open cursor that last read data from the455       buffer in question. See <a class="xref" href="monitoring-stats.html#WAIT-EVENT-BUFFERPIN-TABLE" title="Table 28.6. Wait Events of Type BufferPin">Table 28.6</a>.456      </td></tr><tr><td><code class="literal">Client</code></td><td>The server process is waiting for activity on a socket457       connected to a user application.  Thus, the server expects something458       to happen that is independent of its internal processes.459       <code class="literal">wait_event</code> will identify the specific wait point;460       see <a class="xref" href="monitoring-stats.html#WAIT-EVENT-CLIENT-TABLE" title="Table 28.7. Wait Events of Type Client">Table 28.7</a>.461      </td></tr><tr><td><code class="literal">Extension</code></td><td>The server process is waiting for some condition defined by an462       extension module.463       See <a class="xref" href="monitoring-stats.html#WAIT-EVENT-EXTENSION-TABLE" title="Table 28.8. Wait Events of Type Extension">Table 28.8</a>.464      </td></tr><tr><td><code class="literal">IO</code></td><td>The server process is waiting for an I/O operation to complete.465       <code class="literal">wait_event</code> will identify the specific wait point;466       see <a class="xref" href="monitoring-stats.html#WAIT-EVENT-IO-TABLE" title="Table 28.9. Wait Events of Type IO">Table 28.9</a>.467      </td></tr><tr><td><code class="literal">IPC</code></td><td>The server process is waiting for some interaction with468       another server process.  <code class="literal">wait_event</code> will469       identify the specific wait point;470       see <a class="xref" href="monitoring-stats.html#WAIT-EVENT-IPC-TABLE" title="Table 28.10. Wait Events of Type IPC">Table 28.10</a>.471      </td></tr><tr><td><code class="literal">Lock</code></td><td>The server process is waiting for a heavyweight lock.472       Heavyweight locks, also known as lock manager locks or simply locks,473       primarily protect SQL-visible objects such as tables.  However,474       they are also used to ensure mutual exclusion for certain internal475       operations such as relation extension.  <code class="literal">wait_event</code>476       will identify the type of lock awaited;477       see <a class="xref" href="monitoring-stats.html#WAIT-EVENT-LOCK-TABLE" title="Table 28.11. Wait Events of Type Lock">Table 28.11</a>.478      </td></tr><tr><td><code class="literal">LWLock</code></td><td> The server process is waiting for a lightweight lock.479       Most such locks protect a particular data structure in shared memory.480       <code class="literal">wait_event</code> will contain a name identifying the purpose481       of the lightweight lock.  (Some locks have specific names; others482       are part of a group of locks each with a similar purpose.)483       See <a class="xref" href="monitoring-stats.html#WAIT-EVENT-LWLOCK-TABLE" title="Table 28.12. Wait Events of Type LWLock">Table 28.12</a>.484      </td></tr><tr><td><code class="literal">Timeout</code></td><td>The server process is waiting for a timeout485       to expire.  <code class="literal">wait_event</code> will identify the specific wait486       point; see <a class="xref" href="monitoring-stats.html#WAIT-EVENT-TIMEOUT-TABLE" title="Table 28.13. Wait Events of Type Timeout">Table 28.13</a>.487      </td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-ACTIVITY-TABLE"><p class="title"><strong>Table 28.5. Wait Events of Type <code class="literal">Activity</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type Activity" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">Activity</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">ArchiverMain</code></td><td>Waiting in main loop of archiver process.</td></tr><tr><td><code class="literal">AutoVacuumMain</code></td><td>Waiting in main loop of autovacuum launcher process.</td></tr><tr><td><code class="literal">BgWriterHibernate</code></td><td>Waiting in background writer process, hibernating.</td></tr><tr><td><code class="literal">BgWriterMain</code></td><td>Waiting in main loop of background writer process.</td></tr><tr><td><code class="literal">CheckpointerMain</code></td><td>Waiting in main loop of checkpointer process.</td></tr><tr><td><code class="literal">LogicalApplyMain</code></td><td>Waiting in main loop of logical replication apply process.</td></tr><tr><td><code class="literal">LogicalLauncherMain</code></td><td>Waiting in main loop of logical replication launcher process.</td></tr><tr><td><code class="literal">LogicalParallelApplyMain</code></td><td>Waiting in main loop of logical replication parallel apply488       process.</td></tr><tr><td><code class="literal">RecoveryWalStream</code></td><td>Waiting in main loop of startup process for WAL to arrive, during489       streaming recovery.</td></tr><tr><td><code class="literal">SysLoggerMain</code></td><td>Waiting in main loop of syslogger process.</td></tr><tr><td><code class="literal">WalReceiverMain</code></td><td>Waiting in main loop of WAL receiver process.</td></tr><tr><td><code class="literal">WalSenderMain</code></td><td>Waiting in main loop of WAL sender process.</td></tr><tr><td><code class="literal">WalWriterMain</code></td><td>Waiting in main loop of WAL writer process.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-BUFFERPIN-TABLE"><p class="title"><strong>Table 28.6. Wait Events of Type <code class="literal">BufferPin</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type BufferPin" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">BufferPin</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">BufferPin</code></td><td>Waiting to acquire an exclusive pin on a buffer.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-CLIENT-TABLE"><p class="title"><strong>Table 28.7. Wait Events of Type <code class="literal">Client</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type Client" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">Client</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">ClientRead</code></td><td>Waiting to read data from the client.</td></tr><tr><td><code class="literal">ClientWrite</code></td><td>Waiting to write data to the client.</td></tr><tr><td><code class="literal">GSSOpenServer</code></td><td>Waiting to read data from the client while establishing a GSSAPI490       session.</td></tr><tr><td><code class="literal">LibPQWalReceiverConnect</code></td><td>Waiting in WAL receiver to establish connection to remote491       server.</td></tr><tr><td><code class="literal">LibPQWalReceiverReceive</code></td><td>Waiting in WAL receiver to receive data from remote server.</td></tr><tr><td><code class="literal">SSLOpenServer</code></td><td>Waiting for SSL while attempting connection.</td></tr><tr><td><code class="literal">WalSenderWaitForWAL</code></td><td>Waiting for WAL to be flushed in WAL sender process.</td></tr><tr><td><code class="literal">WalSenderWriteData</code></td><td>Waiting for any activity when processing replies from WAL492       receiver in WAL sender process.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-EXTENSION-TABLE"><p class="title"><strong>Table 28.8. Wait Events of Type <code class="literal">Extension</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type Extension" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">Extension</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">Extension</code></td><td>Waiting in an extension.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-IO-TABLE"><p class="title"><strong>Table 28.9. Wait Events of Type <code class="literal">IO</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type IO" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">IO</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">BaseBackupRead</code></td><td>Waiting for base backup to read from a file.</td></tr><tr><td><code class="literal">BaseBackupSync</code></td><td>Waiting for data written by a base backup to reach durable storage.</td></tr><tr><td><code class="literal">BaseBackupWrite</code></td><td>Waiting for base backup to write to a file.</td></tr><tr><td><code class="literal">BufFileRead</code></td><td>Waiting for a read from a buffered file.</td></tr><tr><td><code class="literal">BufFileTruncate</code></td><td>Waiting for a buffered file to be truncated.</td></tr><tr><td><code class="literal">BufFileWrite</code></td><td>Waiting for a write to a buffered file.</td></tr><tr><td><code class="literal">ControlFileRead</code></td><td>Waiting for a read from the <code class="filename">pg_control</code>493       file.</td></tr><tr><td><code class="literal">ControlFileSync</code></td><td>Waiting for the <code class="filename">pg_control</code> file to reach494       durable storage.</td></tr><tr><td><code class="literal">ControlFileSyncUpdate</code></td><td>Waiting for an update to the <code class="filename">pg_control</code> file495       to reach durable storage.</td></tr><tr><td><code class="literal">ControlFileWrite</code></td><td>Waiting for a write to the <code class="filename">pg_control</code>496       file.</td></tr><tr><td><code class="literal">ControlFileWriteUpdate</code></td><td>Waiting for a write to update the <code class="filename">pg_control</code>497       file.</td></tr><tr><td><code class="literal">CopyFileRead</code></td><td>Waiting for a read during a file copy operation.</td></tr><tr><td><code class="literal">CopyFileWrite</code></td><td>Waiting for a write during a file copy operation.</td></tr><tr><td><code class="literal">DSMAllocate</code></td><td>Waiting for a dynamic shared memory segment to be498       allocated.</td></tr><tr><td><code class="literal">DSMFillZeroWrite</code></td><td>Waiting to fill a dynamic shared memory backing file with499       zeroes.</td></tr><tr><td><code class="literal">DataFileExtend</code></td><td>Waiting for a relation data file to be extended.</td></tr><tr><td><code class="literal">DataFileFlush</code></td><td>Waiting for a relation data file to reach durable storage.</td></tr><tr><td><code class="literal">DataFileImmediateSync</code></td><td>Waiting for an immediate synchronization of a relation data file to500       durable storage.</td></tr><tr><td><code class="literal">DataFilePrefetch</code></td><td>Waiting for an asynchronous prefetch from a relation data501       file.</td></tr><tr><td><code class="literal">DataFileRead</code></td><td>Waiting for a read from a relation data file.</td></tr><tr><td><code class="literal">DataFileSync</code></td><td>Waiting for changes to a relation data file to reach durable storage.</td></tr><tr><td><code class="literal">DataFileTruncate</code></td><td>Waiting for a relation data file to be truncated.</td></tr><tr><td><code class="literal">DataFileWrite</code></td><td>Waiting for a write to a relation data file.</td></tr><tr><td><code class="literal">LockFileAddToDataDirRead</code></td><td>Waiting for a read while adding a line to the data directory lock502       file.</td></tr><tr><td><code class="literal">LockFileAddToDataDirSync</code></td><td>Waiting for data to reach durable storage while adding a line to the503       data directory lock file.</td></tr><tr><td><code class="literal">LockFileAddToDataDirWrite</code></td><td>Waiting for a write while adding a line to the data directory504       lock file.</td></tr><tr><td><code class="literal">LockFileCreateRead</code></td><td>Waiting to read while creating the data directory lock505       file.</td></tr><tr><td><code class="literal">LockFileCreateSync</code></td><td>Waiting for data to reach durable storage while creating the data506       directory lock file.</td></tr><tr><td><code class="literal">LockFileCreateWrite</code></td><td>Waiting for a write while creating the data directory lock507       file.</td></tr><tr><td><code class="literal">LockFileReCheckDataDirRead</code></td><td>Waiting for a read during recheck of the data directory lock508       file.</td></tr><tr><td><code class="literal">LogicalRewriteCheckpointSync</code></td><td>Waiting for logical rewrite mappings to reach durable storage509       during a checkpoint.</td></tr><tr><td><code class="literal">LogicalRewriteMappingSync</code></td><td>Waiting for mapping data to reach durable storage during a logical510       rewrite.</td></tr><tr><td><code class="literal">LogicalRewriteMappingWrite</code></td><td>Waiting for a write of mapping data during a logical511       rewrite.</td></tr><tr><td><code class="literal">LogicalRewriteSync</code></td><td>Waiting for logical rewrite mappings to reach durable512       storage.</td></tr><tr><td><code class="literal">LogicalRewriteTruncate</code></td><td>Waiting for truncate of mapping data during a logical513       rewrite.</td></tr><tr><td><code class="literal">LogicalRewriteWrite</code></td><td>Waiting for a write of logical rewrite mappings.</td></tr><tr><td><code class="literal">RelationMapRead</code></td><td>Waiting for a read of the relation map file.</td></tr><tr><td><code class="literal">RelationMapReplace</code></td><td>Waiting for durable replacement of a relation map file.</td></tr><tr><td><code class="literal">RelationMapWrite</code></td><td>Waiting for a write to the relation map file.</td></tr><tr><td><code class="literal">ReorderBufferRead</code></td><td>Waiting for a read during reorder buffer management.</td></tr><tr><td><code class="literal">ReorderBufferWrite</code></td><td>Waiting for a write during reorder buffer management.</td></tr><tr><td><code class="literal">ReorderLogicalMappingRead</code></td><td>Waiting for a read of a logical mapping during reorder buffer514       management.</td></tr><tr><td><code class="literal">ReplicationSlotRead</code></td><td>Waiting for a read from a replication slot control file.</td></tr><tr><td><code class="literal">ReplicationSlotRestoreSync</code></td><td>Waiting for a replication slot control file to reach durable storage515       while restoring it to memory.</td></tr><tr><td><code class="literal">ReplicationSlotSync</code></td><td>Waiting for a replication slot control file to reach durable516       storage.</td></tr><tr><td><code class="literal">ReplicationSlotWrite</code></td><td>Waiting for a write to a replication slot control file.</td></tr><tr><td><code class="literal">SLRUFlushSync</code></td><td>Waiting for SLRU data to reach durable storage during a checkpoint517       or database shutdown.</td></tr><tr><td><code class="literal">SLRURead</code></td><td>Waiting for a read of an SLRU page.</td></tr><tr><td><code class="literal">SLRUSync</code></td><td>Waiting for SLRU data to reach durable storage following a page518       write.</td></tr><tr><td><code class="literal">SLRUWrite</code></td><td>Waiting for a write of an SLRU page.</td></tr><tr><td><code class="literal">SnapbuildRead</code></td><td>Waiting for a read of a serialized historical catalog519       snapshot.</td></tr><tr><td><code class="literal">SnapbuildSync</code></td><td>Waiting for a serialized historical catalog snapshot to reach520       durable storage.</td></tr><tr><td><code class="literal">SnapbuildWrite</code></td><td>Waiting for a write of a serialized historical catalog521       snapshot.</td></tr><tr><td><code class="literal">TimelineHistoryFileSync</code></td><td>Waiting for a timeline history file received via streaming522       replication to reach durable storage.</td></tr><tr><td><code class="literal">TimelineHistoryFileWrite</code></td><td>Waiting for a write of a timeline history file received via523       streaming replication.</td></tr><tr><td><code class="literal">TimelineHistoryRead</code></td><td>Waiting for a read of a timeline history file.</td></tr><tr><td><code class="literal">TimelineHistorySync</code></td><td>Waiting for a newly created timeline history file to reach durable524       storage.</td></tr><tr><td><code class="literal">TimelineHistoryWrite</code></td><td>Waiting for a write of a newly created timeline history525       file.</td></tr><tr><td><code class="literal">TwophaseFileRead</code></td><td>Waiting for a read of a two phase state file.</td></tr><tr><td><code class="literal">TwophaseFileSync</code></td><td>Waiting for a two phase state file to reach durable storage.</td></tr><tr><td><code class="literal">TwophaseFileWrite</code></td><td>Waiting for a write of a two phase state file.</td></tr><tr><td><code class="literal">VersionFileSync</code></td><td>Waiting for the version file to reach durable storage while526       creating a database.</td></tr><tr><td><code class="literal">VersionFileWrite</code></td><td>Waiting for the version file to be written while creating a database.</td></tr><tr><td><code class="literal">WALBootstrapSync</code></td><td>Waiting for WAL to reach durable storage during527       bootstrapping.</td></tr><tr><td><code class="literal">WALBootstrapWrite</code></td><td>Waiting for a write of a WAL page during bootstrapping.</td></tr><tr><td><code class="literal">WALCopyRead</code></td><td>Waiting for a read when creating a new WAL segment by copying an528       existing one.</td></tr><tr><td><code class="literal">WALCopySync</code></td><td>Waiting for a new WAL segment created by copying an existing one to529       reach durable storage.</td></tr><tr><td><code class="literal">WALCopyWrite</code></td><td>Waiting for a write when creating a new WAL segment by copying an530       existing one.</td></tr><tr><td><code class="literal">WALInitSync</code></td><td>Waiting for a newly initialized WAL file to reach durable531       storage.</td></tr><tr><td><code class="literal">WALInitWrite</code></td><td>Waiting for a write while initializing a new WAL file.</td></tr><tr><td><code class="literal">WALRead</code></td><td>Waiting for a read from a WAL file.</td></tr><tr><td><code class="literal">WALSenderTimelineHistoryRead</code></td><td>Waiting for a read from a timeline history file during a walsender532       timeline command.</td></tr><tr><td><code class="literal">WALSync</code></td><td>Waiting for a WAL file to reach durable storage.</td></tr><tr><td><code class="literal">WALSyncMethodAssign</code></td><td>Waiting for data to reach durable storage while assigning a new533       WAL sync method.</td></tr><tr><td><code class="literal">WALWrite</code></td><td>Waiting for a write to a WAL file.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-IPC-TABLE"><p class="title"><strong>Table 28.10. Wait Events of Type <code class="literal">IPC</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type IPC" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">IPC</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">AppendReady</code></td><td>Waiting for subplan nodes of an <code class="literal">Append</code> plan534       node to be ready.</td></tr><tr><td><code class="literal">ArchiveCleanupCommand</code></td><td>Waiting for <a class="xref" href="runtime-config-wal.html#GUC-ARCHIVE-CLEANUP-COMMAND">archive_cleanup_command</a> to535       complete.</td></tr><tr><td><code class="literal">ArchiveCommand</code></td><td>Waiting for <a class="xref" href="runtime-config-wal.html#GUC-ARCHIVE-COMMAND">archive_command</a> to536       complete.</td></tr><tr><td><code class="literal">BackendTermination</code></td><td>Waiting for the termination of another backend.</td></tr><tr><td><code class="literal">BackupWaitWalArchive</code></td><td>Waiting for WAL files required for a backup to be successfully537       archived.</td></tr><tr><td><code class="literal">BgWorkerShutdown</code></td><td>Waiting for background worker to shut down.</td></tr><tr><td><code class="literal">BgWorkerStartup</code></td><td>Waiting for background worker to start up.</td></tr><tr><td><code class="literal">BtreePage</code></td><td>Waiting for the page number needed to continue a parallel B-tree538       scan to become available.</td></tr><tr><td><code class="literal">BufferIO</code></td><td>Waiting for buffer I/O to complete.</td></tr><tr><td><code class="literal">CheckpointDone</code></td><td>Waiting for a checkpoint to complete.</td></tr><tr><td><code class="literal">CheckpointStart</code></td><td>Waiting for a checkpoint to start.</td></tr><tr><td><code class="literal">ExecuteGather</code></td><td>Waiting for activity from a child process while539       executing a <code class="literal">Gather</code> plan node.</td></tr><tr><td><code class="literal">HashBatchAllocate</code></td><td>Waiting for an elected Parallel Hash participant to allocate a hash540       table.</td></tr><tr><td><code class="literal">HashBatchElect</code></td><td>Waiting to elect a Parallel Hash participant to allocate a hash541       table.</td></tr><tr><td><code class="literal">HashBatchLoad</code></td><td>Waiting for other Parallel Hash participants to finish loading a542       hash table.</td></tr><tr><td><code class="literal">HashBuildAllocate</code></td><td>Waiting for an elected Parallel Hash participant to allocate the543       initial hash table.</td></tr><tr><td><code class="literal">HashBuildElect</code></td><td>Waiting to elect a Parallel Hash participant to allocate the544       initial hash table.</td></tr><tr><td><code class="literal">HashBuildHashInner</code></td><td>Waiting for other Parallel Hash participants to finish hashing the545       inner relation.</td></tr><tr><td><code class="literal">HashBuildHashOuter</code></td><td>Waiting for other Parallel Hash participants to finish partitioning546       the outer relation.</td></tr><tr><td><code class="literal">HashGrowBatchesDecide</code></td><td>Waiting to elect a Parallel Hash participant to decide on future547       batch growth.</td></tr><tr><td><code class="literal">HashGrowBatchesElect</code></td><td>Waiting to elect a Parallel Hash participant to allocate more548       batches.</td></tr><tr><td><code class="literal">HashGrowBatchesFinish</code></td><td>Waiting for an elected Parallel Hash participant to decide on549       future batch growth.</td></tr><tr><td><code class="literal">HashGrowBatchesReallocate</code></td><td>Waiting for an elected Parallel Hash participant to allocate more550       batches.</td></tr><tr><td><code class="literal">HashGrowBatchesRepartition</code></td><td>Waiting for other Parallel Hash participants to finish551       repartitioning.</td></tr><tr><td><code class="literal">HashGrowBucketsElect</code></td><td>Waiting to elect a Parallel Hash participant to allocate more552       buckets.</td></tr><tr><td><code class="literal">HashGrowBucketsReallocate</code></td><td>Waiting for an elected Parallel Hash participant to finish553       allocating more buckets.</td></tr><tr><td><code class="literal">HashGrowBucketsReinsert</code></td><td>Waiting for other Parallel Hash participants to finish inserting554       tuples into new buckets.</td></tr><tr><td><code class="literal">LogicalApplySendData</code></td><td>Waiting for a logical replication leader apply process to send555       data to a parallel apply process.</td></tr><tr><td><code class="literal">LogicalParallelApplyStateChange</code></td><td>Waiting for a logical replication parallel apply process to change556       state.</td></tr><tr><td><code class="literal">LogicalSyncData</code></td><td>Waiting for a logical replication remote server to send data for557       initial table synchronization.</td></tr><tr><td><code class="literal">LogicalSyncStateChange</code></td><td>Waiting for a logical replication remote server to change558       state.</td></tr><tr><td><code class="literal">MessageQueueInternal</code></td><td>Waiting for another process to be attached to a shared message559       queue.</td></tr><tr><td><code class="literal">MessageQueuePutMessage</code></td><td>Waiting to write a protocol message to a shared message queue.</td></tr><tr><td><code class="literal">MessageQueueReceive</code></td><td>Waiting to receive bytes from a shared message queue.</td></tr><tr><td><code class="literal">MessageQueueSend</code></td><td>Waiting to send bytes to a shared message queue.</td></tr><tr><td><code class="literal">ParallelBitmapScan</code></td><td>Waiting for parallel bitmap scan to become initialized.</td></tr><tr><td><code class="literal">ParallelCreateIndexScan</code></td><td>Waiting for parallel <code class="command">CREATE INDEX</code> workers to560       finish heap scan.</td></tr><tr><td><code class="literal">ParallelFinish</code></td><td>Waiting for parallel workers to finish computing.</td></tr><tr><td><code class="literal">ProcArrayGroupUpdate</code></td><td>Waiting for the group leader to clear the transaction ID at561       end of a parallel operation.</td></tr><tr><td><code class="literal">ProcSignalBarrier</code></td><td>Waiting for a barrier event to be processed by all562       backends.</td></tr><tr><td><code class="literal">Promote</code></td><td>Waiting for standby promotion.</td></tr><tr><td><code class="literal">RecoveryConflictSnapshot</code></td><td>Waiting for recovery conflict resolution for a vacuum563       cleanup.</td></tr><tr><td><code class="literal">RecoveryConflictTablespace</code></td><td>Waiting for recovery conflict resolution for dropping a564       tablespace.</td></tr><tr><td><code class="literal">RecoveryEndCommand</code></td><td>Waiting for <a class="xref" href="runtime-config-wal.html#GUC-RECOVERY-END-COMMAND">recovery_end_command</a> to565       complete.</td></tr><tr><td><code class="literal">RecoveryPause</code></td><td>Waiting for recovery to be resumed.</td></tr><tr><td><code class="literal">ReplicationOriginDrop</code></td><td>Waiting for a replication origin to become inactive so it can be566       dropped.</td></tr><tr><td><code class="literal">ReplicationSlotDrop</code></td><td>Waiting for a replication slot to become inactive so it can be567       dropped.</td></tr><tr><td><code class="literal">RestoreCommand</code></td><td>Waiting for <a class="xref" href="runtime-config-wal.html#GUC-RESTORE-COMMAND">restore_command</a> to568       complete.</td></tr><tr><td><code class="literal">SafeSnapshot</code></td><td>Waiting to obtain a valid snapshot for a <code class="literal">READ ONLY569       DEFERRABLE</code> transaction.</td></tr><tr><td><code class="literal">SyncRep</code></td><td>Waiting for confirmation from a remote server during synchronous570       replication.</td></tr><tr><td><code class="literal">WalReceiverExit</code></td><td>Waiting for the WAL receiver to exit.</td></tr><tr><td><code class="literal">WalReceiverWaitStart</code></td><td>Waiting for startup process to send initial data for streaming571       replication.</td></tr><tr><td><code class="literal">XactGroupUpdate</code></td><td>Waiting for the group leader to update transaction status at572       end of a parallel operation.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-LOCK-TABLE"><p class="title"><strong>Table 28.11. Wait Events of Type <code class="literal">Lock</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type Lock" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">Lock</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">advisory</code></td><td>Waiting to acquire an advisory user lock.</td></tr><tr><td><code class="literal">applytransaction</code></td><td>Waiting to acquire a lock on a remote transaction being applied573      by a logical replication subscriber.</td></tr><tr><td><code class="literal">extend</code></td><td>Waiting to extend a relation.</td></tr><tr><td><code class="literal">frozenid</code></td><td>Waiting to574       update <code class="structname">pg_database</code>.<code class="structfield">datfrozenxid</code>575       and <code class="structname">pg_database</code>.<code class="structfield">datminmxid</code>.</td></tr><tr><td><code class="literal">object</code></td><td>Waiting to acquire a lock on a non-relation database object.</td></tr><tr><td><code class="literal">page</code></td><td>Waiting to acquire a lock on a page of a relation.</td></tr><tr><td><code class="literal">relation</code></td><td>Waiting to acquire a lock on a relation.</td></tr><tr><td><code class="literal">spectoken</code></td><td>Waiting to acquire a speculative insertion lock.</td></tr><tr><td><code class="literal">transactionid</code></td><td>Waiting for a transaction to finish.</td></tr><tr><td><code class="literal">tuple</code></td><td>Waiting to acquire a lock on a tuple.</td></tr><tr><td><code class="literal">userlock</code></td><td>Waiting to acquire a user lock.</td></tr><tr><td><code class="literal">virtualxid</code></td><td>Waiting to acquire a virtual transaction ID lock;  see576      <a class="xref" href="transaction-id.html" title="74.1. Transactions and Identifiers">Section 74.1</a>.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="WAIT-EVENT-LWLOCK-TABLE"><p class="title"><strong>Table 28.12. Wait Events of Type <code class="literal">LWLock</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type LWLock" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">LWLock</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">AddinShmemInit</code></td><td>Waiting to manage an extension's space allocation in shared577       memory.</td></tr><tr><td><code class="literal">AutoFile</code></td><td>Waiting to update the <code class="filename">postgresql.auto.conf</code>578       file.</td></tr><tr><td><code class="literal">Autovacuum</code></td><td>Waiting to read or update the current state of autovacuum579       workers.</td></tr><tr><td><code class="literal">AutovacuumSchedule</code></td><td>Waiting to ensure that a table selected for autovacuum580       still needs vacuuming.</td></tr><tr><td><code class="literal">BackgroundWorker</code></td><td>Waiting to read or update background worker state.</td></tr><tr><td><code class="literal">BtreeVacuum</code></td><td>Waiting to read or update vacuum-related information for a581       B-tree index.</td></tr><tr><td><code class="literal">BufferContent</code></td><td>Waiting to access a data page in memory.</td></tr><tr><td><code class="literal">BufferMapping</code></td><td>Waiting to associate a data block with a buffer in the buffer582       pool.</td></tr><tr><td><code class="literal">CheckpointerComm</code></td><td>Waiting to manage fsync requests.</td></tr><tr><td><code class="literal">CommitTs</code></td><td>Waiting to read or update the last value set for a583       transaction commit timestamp.</td></tr><tr><td><code class="literal">CommitTsBuffer</code></td><td>Waiting for I/O on a commit timestamp SLRU buffer.</td></tr><tr><td><code class="literal">CommitTsSLRU</code></td><td>Waiting to access the commit timestamp SLRU cache.</td></tr><tr><td><code class="literal">ControlFile</code></td><td>Waiting to read or update the <code class="filename">pg_control</code>584       file or create a new WAL file.</td></tr><tr><td><code class="literal">DynamicSharedMemoryControl</code></td><td>Waiting to read or update dynamic shared memory allocation585       information.</td></tr><tr><td><code class="literal">LockFastPath</code></td><td>Waiting to read or update a process' fast-path lock586       information.</td></tr><tr><td><code class="literal">LockManager</code></td><td>Waiting to read or update information587       about <span class="quote">“<span class="quote">heavyweight</span>”</span> locks.</td></tr><tr><td><code class="literal">LogicalRepLauncherDSA</code></td><td>Waiting to access logical replication launcher's dynamic shared588       memory allocator.</td></tr><tr><td><code class="literal">LogicalRepLauncherHash</code></td><td>Waiting to access logical replication launcher's shared589       hash table.</td></tr><tr><td><code class="literal">LogicalRepWorker</code></td><td>Waiting to read or update the state of logical replication590       workers.</td></tr><tr><td><code class="literal">MultiXactGen</code></td><td>Waiting to read or update shared multixact state.</td></tr><tr><td><code class="literal">MultiXactMemberBuffer</code></td><td>Waiting for I/O on a multixact member SLRU buffer.</td></tr><tr><td><code class="literal">MultiXactMemberSLRU</code></td><td>Waiting to access the multixact member SLRU cache.</td></tr><tr><td><code class="literal">MultiXactOffsetBuffer</code></td><td>Waiting for I/O on a multixact offset SLRU buffer.</td></tr><tr><td><code class="literal">MultiXactOffsetSLRU</code></td><td>Waiting to access the multixact offset SLRU cache.</td></tr><tr><td><code class="literal">MultiXactTruncation</code></td><td>Waiting to read or truncate multixact information.</td></tr><tr><td><code class="literal">NotifyBuffer</code></td><td>Waiting for I/O on a <code class="command">NOTIFY</code> message SLRU591       buffer.</td></tr><tr><td><code class="literal">NotifyQueue</code></td><td>Waiting to read or update <code class="command">NOTIFY</code> messages.</td></tr><tr><td><code class="literal">NotifyQueueTail</code></td><td>Waiting to update limit on <code class="command">NOTIFY</code> message592       storage.</td></tr><tr><td><code class="literal">NotifySLRU</code></td><td>Waiting to access the <code class="command">NOTIFY</code> message SLRU593       cache.</td></tr><tr><td><code class="literal">OidGen</code></td><td>Waiting to allocate a new OID.</td></tr><tr><td><code class="literal">OldSnapshotTimeMap</code></td><td>Waiting to read or update old snapshot control information.</td></tr><tr><td><code class="literal">ParallelAppend</code></td><td>Waiting to choose the next subplan during Parallel Append plan594       execution.</td></tr><tr><td><code class="literal">ParallelHashJoin</code></td><td>Waiting to synchronize workers during Parallel Hash Join plan595       execution.</td></tr><tr><td><code class="literal">ParallelQueryDSA</code></td><td>Waiting for parallel query dynamic shared memory allocation.</td></tr><tr><td><code class="literal">PerSessionDSA</code></td><td>Waiting for parallel query dynamic shared memory allocation.</td></tr><tr><td><code class="literal">PerSessionRecordType</code></td><td>Waiting to access a parallel query's information about composite596       types.</td></tr><tr><td><code class="literal">PerSessionRecordTypmod</code></td><td>Waiting to access a parallel query's information about type597       modifiers that identify anonymous record types.</td></tr><tr><td><code class="literal">PerXactPredicateList</code></td><td>Waiting to access the list of predicate locks held by the current598       serializable transaction during a parallel query.</td></tr><tr><td><code class="literal">PgStatsData</code></td><td>Waiting for shared memory stats data access</td></tr><tr><td><code class="literal">PgStatsDSA</code></td><td>Waiting for stats dynamic shared memory allocator access</td></tr><tr><td><code class="literal">PgStatsHash</code></td><td>Waiting for stats shared memory hash table access</td></tr><tr><td><code class="literal">PredicateLockManager</code></td><td>Waiting to access predicate lock information used by599       serializable transactions.</td></tr><tr><td><code class="literal">ProcArray</code></td><td>Waiting to access the shared per-process data structures600       (typically, to get a snapshot or report a session's transaction601       ID).</td></tr><tr><td><code class="literal">RelationMapping</code></td><td>Waiting to read or update602       a <code class="filename">pg_filenode.map</code> file (used to track the603       filenode assignments of certain system catalogs).</td></tr><tr><td><code class="literal">RelCacheInit</code></td><td>Waiting to read or update a <code class="filename">pg_internal.init</code>604       relation cache initialization file.</td></tr><tr><td><code class="literal">ReplicationOrigin</code></td><td>Waiting to create, drop or use a replication origin.</td></tr><tr><td><code class="literal">ReplicationOriginState</code></td><td>Waiting to read or update the progress of one replication605       origin.</td></tr><tr><td><code class="literal">ReplicationSlotAllocation</code></td><td>Waiting to allocate or free a replication slot.</td></tr><tr><td><code class="literal">ReplicationSlotControl</code></td><td>Waiting to read or update replication slot state.</td></tr><tr><td><code class="literal">ReplicationSlotIO</code></td><td>Waiting for I/O on a replication slot.</td></tr><tr><td><code class="literal">SerialBuffer</code></td><td>Waiting for I/O on a serializable transaction conflict SLRU606       buffer.</td></tr><tr><td><code class="literal">SerializableFinishedList</code></td><td>Waiting to access the list of finished serializable607       transactions.</td></tr><tr><td><code class="literal">SerializablePredicateList</code></td><td>Waiting to access the list of predicate locks held by608       serializable transactions.</td></tr><tr><td><code class="literal">SerializableXactHash</code></td><td>Waiting to read or update information about serializable609       transactions.</td></tr><tr><td><code class="literal">SerialSLRU</code></td><td>Waiting to access the serializable transaction conflict SLRU610       cache.</td></tr><tr><td><code class="literal">SharedTidBitmap</code></td><td>Waiting to access a shared TID bitmap during a parallel bitmap611       index scan.</td></tr><tr><td><code class="literal">SharedTupleStore</code></td><td>Waiting to access a shared tuple store during parallel612       query.</td></tr><tr><td><code class="literal">ShmemIndex</code></td><td>Waiting to find or allocate space in shared memory.</td></tr><tr><td><code class="literal">SInvalRead</code></td><td>Waiting to retrieve messages from the shared catalog invalidation613       queue.</td></tr><tr><td><code class="literal">SInvalWrite</code></td><td>Waiting to add a message to the shared catalog invalidation614      queue.</td></tr><tr><td><code class="literal">SubtransBuffer</code></td><td>Waiting for I/O on a sub-transaction SLRU buffer.</td></tr><tr><td><code class="literal">SubtransSLRU</code></td><td>Waiting to access the sub-transaction SLRU cache.</td></tr><tr><td><code class="literal">SyncRep</code></td><td>Waiting to read or update information about the state of615       synchronous replication.</td></tr><tr><td><code class="literal">SyncScan</code></td><td>Waiting to select the starting location of a synchronized table616       scan.</td></tr><tr><td><code class="literal">TablespaceCreate</code></td><td>Waiting to create or drop a tablespace.</td></tr><tr><td><code class="literal">TwoPhaseState</code></td><td>Waiting to read or update the state of prepared transactions.</td></tr><tr><td><code class="literal">WALBufMapping</code></td><td>Waiting to replace a page in WAL buffers.</td></tr><tr><td><code class="literal">WALInsert</code></td><td>Waiting to insert WAL data into a memory buffer.</td></tr><tr><td><code class="literal">WALWrite</code></td><td>Waiting for WAL buffers to be written to disk.</td></tr><tr><td><code class="literal">WrapLimitsVacuum</code></td><td>Waiting to update limits on transaction id and multixact617       consumption.</td></tr><tr><td><code class="literal">XactBuffer</code></td><td>Waiting for I/O on a transaction status SLRU buffer.</td></tr><tr><td><code class="literal">XactSLRU</code></td><td>Waiting to access the transaction status SLRU cache.</td></tr><tr><td><code class="literal">XactTruncation</code></td><td>Waiting to execute <code class="function">pg_xact_status</code> or update618       the oldest transaction ID available to it.</td></tr><tr><td><code class="literal">XidGen</code></td><td>Waiting to allocate a new transaction ID.</td></tr></tbody></table></div></div><br class="table-break" /><div class="note"><h3 class="title">Note</h3><p>619     Extensions can add <code class="literal">LWLock</code> types to the list shown in620     <a class="xref" href="monitoring-stats.html#WAIT-EVENT-LWLOCK-TABLE" title="Table 28.12. Wait Events of Type LWLock">Table 28.12</a>.  In some cases, the name621     assigned by an extension will not be available in all server processes;622     so an <code class="literal">LWLock</code> wait event might be reported as623     just <span class="quote">“<span class="quote"><code class="literal">extension</code></span>”</span> rather than the624     extension-assigned name.625    </p></div><div class="table" id="WAIT-EVENT-TIMEOUT-TABLE"><p class="title"><strong>Table 28.13. Wait Events of Type <code class="literal">Timeout</code></strong></p><div class="table-contents"><table class="table" summary="Wait Events of Type Timeout" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><code class="literal">Timeout</code> Wait Event</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">BaseBackupThrottle</code></td><td>Waiting during base backup when throttling activity.</td></tr><tr><td><code class="literal">CheckpointWriteDelay</code></td><td>Waiting between writes while performing a checkpoint.</td></tr><tr><td><code class="literal">PgSleep</code></td><td>Waiting due to a call to <code class="function">pg_sleep</code> or626       a sibling function.</td></tr><tr><td><code class="literal">RecoveryApplyDelay</code></td><td>Waiting to apply WAL during recovery because of a delay627       setting.</td></tr><tr><td><code class="literal">RecoveryRetrieveRetryInterval</code></td><td>Waiting during recovery when WAL data is not available from any628       source (<code class="filename">pg_wal</code>, archive or stream).</td></tr><tr><td><code class="literal">RegisterSyncRequest</code></td><td>Waiting while sending synchronization requests to the629       checkpointer, because the request queue is full.</td></tr><tr><td><code class="literal">SpinDelay</code></td><td>Waiting while acquiring a contended spinlock.</td></tr><tr><td><code class="literal">VacuumDelay</code></td><td>Waiting in a cost-based vacuum delay point.</td></tr><tr><td><code class="literal">VacuumTruncate</code></td><td>Waiting to acquire an exclusive lock to truncate off any630       empty pages at the end of a table vacuumed.</td></tr></tbody></table></div></div><br class="table-break" /><p>631     Here is an example of how wait events can be viewed:632 633</p><pre class="programlisting">634SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event is NOT NULL;635 pid  | wait_event_type | wait_event636------+-----------------+------------637 2540 | Lock            | relation638 6644 | LWLock          | ProcArray639(2 rows)640</pre><p>641   </p></div><div class="sect2" id="MONITORING-PG-STAT-REPLICATION-VIEW"><div class="titlepage"><div><div><h3 class="title">28.2.4. <code class="structname">pg_stat_replication</code> <a href="#MONITORING-PG-STAT-REPLICATION-VIEW" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.8.2" class="indexterm"></a><p>642   The <code class="structname">pg_stat_replication</code> view will contain one row643   per WAL sender process, showing statistics about replication to that644   sender's connected standby server.  Only directly connected standbys are645   listed; no information is available about downstream standby servers.646  </p><div class="table" id="PG-STAT-REPLICATION-VIEW"><p class="title"><strong>Table 28.14. <code class="structname">pg_stat_replication</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_replication View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">647       Column Type648      </p>649      <p>650       Description651      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">652       <code class="structfield">pid</code> <code class="type">integer</code>653      </p>654      <p>655       Process ID of a WAL sender process656      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">657       <code class="structfield">usesysid</code> <code class="type">oid</code>658      </p>659      <p>660       OID of the user logged into this WAL sender process661      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">662       <code class="structfield">usename</code> <code class="type">name</code>663      </p>664      <p>665       Name of the user logged into this WAL sender process666      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">667       <code class="structfield">application_name</code> <code class="type">text</code>668      </p>669      <p>670       Name of the application that is connected671       to this WAL sender672      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">673       <code class="structfield">client_addr</code> <code class="type">inet</code>674      </p>675      <p>676       IP address of the client connected to this WAL sender.677       If this field is null, it indicates that the client is678       connected via a Unix socket on the server machine.679      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">680       <code class="structfield">client_hostname</code> <code class="type">text</code>681      </p>682      <p>683       Host name of the connected client, as reported by a684       reverse DNS lookup of <code class="structfield">client_addr</code>. This field will685       only be non-null for IP connections, and only when <a class="xref" href="runtime-config-logging.html#GUC-LOG-HOSTNAME">log_hostname</a> is enabled.686      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">687       <code class="structfield">client_port</code> <code class="type">integer</code>688      </p>689      <p>690       TCP port number that the client is using for communication691       with this WAL sender, or <code class="literal">-1</code> if a Unix socket is used692      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">693       <code class="structfield">backend_start</code> <code class="type">timestamp with time zone</code>694      </p>695      <p>696       Time when this process was started, i.e., when the697       client connected to this WAL sender698      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">699       <code class="structfield">backend_xmin</code> <code class="type">xid</code>700      </p>701      <p>702       This standby's <code class="literal">xmin</code> horizon reported703       by <a class="xref" href="runtime-config-replication.html#GUC-HOT-STANDBY-FEEDBACK">hot_standby_feedback</a>.704      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">705       <code class="structfield">state</code> <code class="type">text</code>706      </p>707      <p>708       Current WAL sender state.709       Possible values are:710       </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>711          <code class="literal">startup</code>: This WAL sender is starting up.712         </p></li><li class="listitem"><p>713          <code class="literal">catchup</code>: This WAL sender's connected standby is714          catching up with the primary.715         </p></li><li class="listitem"><p>716          <code class="literal">streaming</code>: This WAL sender is streaming changes717          after its connected standby server has caught up with the primary.718         </p></li><li class="listitem"><p>719          <code class="literal">backup</code>: This WAL sender is sending a backup.720         </p></li><li class="listitem"><p>721          <code class="literal">stopping</code>: This WAL sender is stopping.722         </p></li></ul></div><p>723      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">724       <code class="structfield">sent_lsn</code> <code class="type">pg_lsn</code>725      </p>726      <p>727       Last write-ahead log location sent on this connection728      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">729       <code class="structfield">write_lsn</code> <code class="type">pg_lsn</code>730      </p>731      <p>732       Last write-ahead log location written to disk by this standby733       server734      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">735       <code class="structfield">flush_lsn</code> <code class="type">pg_lsn</code>736      </p>737      <p>738       Last write-ahead log location flushed to disk by this standby739       server740      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">741       <code class="structfield">replay_lsn</code> <code class="type">pg_lsn</code>742      </p>743      <p>744       Last write-ahead log location replayed into the database on this745       standby server746      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">747       <code class="structfield">write_lag</code> <code class="type">interval</code>748      </p>749      <p>750       Time elapsed between flushing recent WAL locally and receiving751       notification that this standby server has written it (but not yet752       flushed it or applied it).  This can be used to gauge the delay that753       <code class="literal">synchronous_commit</code> level754       <code class="literal">remote_write</code> incurred while committing if this755       server was configured as a synchronous standby.756      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">757       <code class="structfield">flush_lag</code> <code class="type">interval</code>758      </p>759      <p>760       Time elapsed between flushing recent WAL locally and receiving761       notification that this standby server has written and flushed it762       (but not yet applied it).  This can be used to gauge the delay that763       <code class="literal">synchronous_commit</code> level764       <code class="literal">on</code> incurred while committing if this765       server was configured as a synchronous standby.766      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">767       <code class="structfield">replay_lag</code> <code class="type">interval</code>768      </p>769      <p>770       Time elapsed between flushing recent WAL locally and receiving771       notification that this standby server has written, flushed and772       applied it.  This can be used to gauge the delay that773       <code class="literal">synchronous_commit</code> level774       <code class="literal">remote_apply</code> incurred while committing if this775       server was configured as a synchronous standby.776      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">777       <code class="structfield">sync_priority</code> <code class="type">integer</code>778      </p>779      <p>780       Priority of this standby server for being chosen as the781       synchronous standby in a priority-based synchronous replication.782       This has no effect in a quorum-based synchronous replication.783      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">784       <code class="structfield">sync_state</code> <code class="type">text</code>785      </p>786      <p>787       Synchronous state of this standby server.788       Possible values are:789       </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>790          <code class="literal">async</code>: This standby server is asynchronous.791         </p></li><li class="listitem"><p>792          <code class="literal">potential</code>: This standby server is now asynchronous,793          but can potentially become synchronous if one of current794          synchronous ones fails.795         </p></li><li class="listitem"><p>796          <code class="literal">sync</code>: This standby server is synchronous.797         </p></li><li class="listitem"><p>798          <code class="literal">quorum</code>: This standby server is considered as a candidate799          for quorum standbys.800         </p></li></ul></div><p>801      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">802       <code class="structfield">reply_time</code> <code class="type">timestamp with time zone</code>803      </p>804      <p>805       Send time of last reply message received from standby server806      </p></td></tr></tbody></table></div></div><br class="table-break" /><p>807   The lag times reported in the <code class="structname">pg_stat_replication</code>808   view are measurements of the time taken for recent WAL to be written,809   flushed and replayed and for the sender to know about it.  These times810   represent the commit delay that was (or would have been) introduced by each811   synchronous commit level, if the remote server was configured as a812   synchronous standby.  For an asynchronous standby, the813   <code class="structfield">replay_lag</code> column approximates the delay814   before recent transactions became visible to queries.  If the standby815   server has entirely caught up with the sending server and there is no more816   WAL activity, the most recently measured lag times will continue to be817   displayed for a short time and then show NULL.818  </p><p>819   Lag times work automatically for physical replication. Logical decoding820   plugins may optionally emit tracking messages; if they do not, the tracking821   mechanism will simply display NULL lag.822  </p><div class="note"><h3 class="title">Note</h3><p>823    The reported lag times are not predictions of how long it will take for824    the standby to catch up with the sending server assuming the current825    rate of replay.  Such a system would show similar times while new WAL is826    being generated, but would differ when the sender becomes idle.  In827    particular, when the standby has caught up completely,828    <code class="structname">pg_stat_replication</code> shows the time taken to829    write, flush and replay the most recent reported WAL location rather than830    zero as some users might expect.  This is consistent with the goal of831    measuring synchronous commit and transaction visibility delays for832    recent write transactions.833    To reduce confusion for users expecting a different model of lag, the834    lag columns revert to NULL after a short time on a fully replayed idle835    system. Monitoring systems should choose whether to represent this836    as missing data, zero or continue to display the last known value.837   </p></div></div><div class="sect2" id="MONITORING-PG-STAT-REPLICATION-SLOTS-VIEW"><div class="titlepage"><div><div><h3 class="title">28.2.5. <code class="structname">pg_stat_replication_slots</code> <a href="#MONITORING-PG-STAT-REPLICATION-SLOTS-VIEW" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.9.2" class="indexterm"></a><p>838   The <code class="structname">pg_stat_replication_slots</code> view will contain839   one row per logical replication slot, showing statistics about its usage.840  </p><div class="table" id="PG-STAT-REPLICATION-SLOTS-VIEW"><p class="title"><strong>Table 28.15. <code class="structname">pg_stat_replication_slots</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_replication_slots View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">841        Column Type842       </p>843       <p>844        Description845      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">846        <code class="structfield">slot_name</code> <code class="type">text</code>847       </p>848       <p>849        A unique, cluster-wide identifier for the replication slot850      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">851        <code class="structfield">spill_txns</code> <code class="type">bigint</code>852       </p>853       <p>854        Number of transactions spilled to disk once the memory used by855        logical decoding to decode changes from WAL has exceeded856        <code class="literal">logical_decoding_work_mem</code>. The counter gets857        incremented for both top-level transactions and subtransactions.858      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">859        <code class="structfield">spill_count</code> <code class="type">bigint</code>860       </p>861       <p>862        Number of times transactions were spilled to disk while decoding863        changes from WAL for this slot. This counter is incremented each time864        a transaction is spilled, and the same transaction may be spilled865        multiple times.866      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">867        <code class="structfield">spill_bytes</code> <code class="type">bigint</code>868       </p>869       <p>870        Amount of decoded transaction data spilled to disk while performing871        decoding of changes from WAL for this slot. This and other spill872        counters can be used to gauge the I/O which occurred during logical873        decoding and allow tuning <code class="literal">logical_decoding_work_mem</code>.874      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">875        <code class="structfield">stream_txns</code> <code class="type">bigint</code>876       </p>877       <p>878        Number of in-progress transactions streamed to the decoding output879        plugin after the memory used by logical decoding to decode changes880        from WAL for this slot has exceeded881        <code class="literal">logical_decoding_work_mem</code>. Streaming only882        works with top-level transactions (subtransactions can't be streamed883        independently), so the counter is not incremented for subtransactions.884       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">885        <code class="structfield">stream_count</code><code class="type">bigint</code>886       </p>887       <p>888        Number of times in-progress transactions were streamed to the decoding889        output plugin while decoding changes from WAL for this slot. This890        counter is incremented each time a transaction is streamed, and the891        same transaction may be streamed multiple times.892      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">893        <code class="structfield">stream_bytes</code><code class="type">bigint</code>894       </p>895       <p>896        Amount of transaction data decoded for streaming in-progress897        transactions to the decoding output plugin while decoding changes from898        WAL for this slot. This and other streaming counters for this slot can899        be used to tune <code class="literal">logical_decoding_work_mem</code>.900       </p>901      </td></tr><tr><td class="catalog_table_entry"><p class="column_definition">902        <code class="structfield">total_txns</code> <code class="type">bigint</code>903       </p>904       <p>905        Number of decoded transactions sent to the decoding output plugin for906        this slot. This counts top-level transactions only, and is not incremented907        for subtransactions. Note that this includes the transactions that are908        streamed and/or spilled.909       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">910        <code class="structfield">total_bytes</code><code class="type">bigint</code>911       </p>912       <p>913        Amount of transaction data decoded for sending transactions to the914        decoding output plugin while decoding changes from WAL for this slot.915        Note that this includes data that is streamed and/or spilled.916       </p>917      </td></tr><tr><td class="catalog_table_entry"><p class="column_definition">918        <code class="structfield">stats_reset</code> <code class="type">timestamp with time zone</code>919       </p>920       <p>921        Time at which these statistics were last reset922       </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="MONITORING-PG-STAT-WAL-RECEIVER-VIEW"><div class="titlepage"><div><div><h3 class="title">28.2.6. <code class="structname">pg_stat_wal_receiver</code> <a href="#MONITORING-PG-STAT-WAL-RECEIVER-VIEW" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.10.2" class="indexterm"></a><p>923   The <code class="structname">pg_stat_wal_receiver</code> view will contain only924   one row, showing statistics about the WAL receiver from that receiver's925   connected server.926  </p><div class="table" id="PG-STAT-WAL-RECEIVER-VIEW"><p class="title"><strong>Table 28.16. <code class="structname">pg_stat_wal_receiver</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_wal_receiver View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">927       Column Type928      </p>929      <p>930       Description931      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">932       <code class="structfield">pid</code> <code class="type">integer</code>933      </p>934      <p>935       Process ID of the WAL receiver process936      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">937       <code class="structfield">status</code> <code class="type">text</code>938      </p>939      <p>940       Activity status of the WAL receiver process941      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">942       <code class="structfield">receive_start_lsn</code> <code class="type">pg_lsn</code>943      </p>944      <p>945       First write-ahead log location used when WAL receiver is946       started947      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">948       <code class="structfield">receive_start_tli</code> <code class="type">integer</code>949      </p>950      <p>951       First timeline number used when WAL receiver is started952      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">953       <code class="structfield">written_lsn</code> <code class="type">pg_lsn</code>954      </p>955      <p>956       Last write-ahead log location already received and written to disk,957       but not flushed. This should not be used for data integrity checks.958      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">959       <code class="structfield">flushed_lsn</code> <code class="type">pg_lsn</code>960      </p>961      <p>962       Last write-ahead log location already received and flushed to963       disk, the initial value of this field being the first log location used964       when WAL receiver is started965      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">966       <code class="structfield">received_tli</code> <code class="type">integer</code>967      </p>968      <p>969       Timeline number of last write-ahead log location received and970       flushed to disk, the initial value of this field being the timeline971       number of the first log location used when WAL receiver is started972      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">973       <code class="structfield">last_msg_send_time</code> <code class="type">timestamp with time zone</code>974      </p>975      <p>976       Send time of last message received from origin WAL sender977      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">978       <code class="structfield">last_msg_receipt_time</code> <code class="type">timestamp with time zone</code>979      </p>980      <p>981       Receipt time of last message received from origin WAL sender982      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">983       <code class="structfield">latest_end_lsn</code> <code class="type">pg_lsn</code>984      </p>985      <p>986       Last write-ahead log location reported to origin WAL sender987      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">988       <code class="structfield">latest_end_time</code> <code class="type">timestamp with time zone</code>989      </p>990      <p>991       Time of last write-ahead log location reported to origin WAL sender992      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">993       <code class="structfield">slot_name</code> <code class="type">text</code>994      </p>995      <p>996       Replication slot name used by this WAL receiver997      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">998       <code class="structfield">sender_host</code> <code class="type">text</code>999      </p>1000      <p>1001       Host of the <span class="productname">PostgreSQL</span> instance1002       this WAL receiver is connected to. This can be a host name,1003       an IP address, or a directory path if the connection is via1004       Unix socket.  (The path case can be distinguished because it1005       will always be an absolute path, beginning with <code class="literal">/</code>.)1006      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1007       <code class="structfield">sender_port</code> <code class="type">integer</code>1008      </p>1009      <p>1010       Port number of the <span class="productname">PostgreSQL</span> instance1011       this WAL receiver is connected to.1012      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1013       <code class="structfield">conninfo</code> <code class="type">text</code>1014      </p>1015      <p>1016       Connection string used by this WAL receiver,1017       with security-sensitive fields obfuscated.1018      </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="MONITORING-PG-STAT-RECOVERY-PREFETCH"><div class="titlepage"><div><div><h3 class="title">28.2.7. <code class="structname">pg_stat_recovery_prefetch</code> <a href="#MONITORING-PG-STAT-RECOVERY-PREFETCH" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.11.2" class="indexterm"></a><p>1019   The <code class="structname">pg_stat_recovery_prefetch</code> view will contain1020   only one row.  The columns <code class="structfield">wal_distance</code>,1021   <code class="structfield">block_distance</code> and1022   <code class="structfield">io_depth</code> show current values, and the1023   other columns show cumulative counters that can be reset1024   with the <code class="function">pg_stat_reset_shared</code> function.1025  </p><div class="table" id="PG-STAT-RECOVERY-PREFETCH-VIEW"><p class="title"><strong>Table 28.17. <code class="structname">pg_stat_recovery_prefetch</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_recovery_prefetch View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">1026       Column Type1027      </p>1028      <p>1029       Description1030      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry">1031       <p class="column_definition">1032        <code class="structfield">stats_reset</code> <code class="type">timestamp with time zone</code>1033       </p>1034       <p>1035        Time at which these statistics were last reset1036       </p>1037      </td></tr><tr><td class="catalog_table_entry">1038       <p class="column_definition">1039        <code class="structfield">prefetch</code> <code class="type">bigint</code>1040       </p>1041       <p>1042        Number of blocks prefetched because they were not in the buffer pool1043       </p>1044      </td></tr><tr><td class="catalog_table_entry">1045       <p class="column_definition">1046        <code class="structfield">hit</code> <code class="type">bigint</code>1047       </p>1048       <p>1049        Number of blocks not prefetched because they were already in the buffer pool1050       </p>1051      </td></tr><tr><td class="catalog_table_entry">1052       <p class="column_definition">1053        <code class="structfield">skip_init</code> <code class="type">bigint</code>1054       </p>1055       <p>1056        Number of blocks not prefetched because they would be zero-initialized1057       </p>1058      </td></tr><tr><td class="catalog_table_entry">1059       <p class="column_definition">1060        <code class="structfield">skip_new</code> <code class="type">bigint</code>1061       </p>1062       <p>1063        Number of blocks not prefetched because they didn't exist yet1064       </p>1065      </td></tr><tr><td class="catalog_table_entry">1066       <p class="column_definition">1067        <code class="structfield">skip_fpw</code> <code class="type">bigint</code>1068       </p>1069       <p>1070        Number of blocks not prefetched because a full page image was included in the WAL1071       </p>1072      </td></tr><tr><td class="catalog_table_entry">1073       <p class="column_definition">1074        <code class="structfield">skip_rep</code> <code class="type">bigint</code>1075       </p>1076       <p>1077        Number of blocks not prefetched because they were already recently prefetched1078       </p>1079      </td></tr><tr><td class="catalog_table_entry">1080       <p class="column_definition">1081        <code class="structfield">wal_distance</code> <code class="type">int</code>1082       </p>1083       <p>1084        How many bytes ahead the prefetcher is looking1085       </p>1086      </td></tr><tr><td class="catalog_table_entry">1087       <p class="column_definition">1088        <code class="structfield">block_distance</code> <code class="type">int</code>1089       </p>1090       <p>1091        How many blocks ahead the prefetcher is looking1092       </p>1093      </td></tr><tr><td class="catalog_table_entry">1094       <p class="column_definition">1095        <code class="structfield">io_depth</code> <code class="type">int</code>1096       </p>1097       <p>1098        How many prefetches have been initiated but are not yet known to have completed1099       </p>1100      </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="MONITORING-PG-STAT-SUBSCRIPTION"><div class="titlepage"><div><div><h3 class="title">28.2.8. <code class="structname">pg_stat_subscription</code> <a href="#MONITORING-PG-STAT-SUBSCRIPTION" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.12.2" class="indexterm"></a><div class="table" id="PG-STAT-SUBSCRIPTION"><p class="title"><strong>Table 28.18. <code class="structname">pg_stat_subscription</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_subscription View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">1101       Column Type1102      </p>1103      <p>1104       Description1105      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">1106       <code class="structfield">subid</code> <code class="type">oid</code>1107      </p>1108      <p>1109       OID of the subscription1110      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1111       <code class="structfield">subname</code> <code class="type">name</code>1112      </p>1113      <p>1114       Name of the subscription1115      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1116       <code class="structfield">pid</code> <code class="type">integer</code>1117      </p>1118      <p>1119       Process ID of the subscription worker process1120      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1121       <code class="structfield">leader_pid</code> <code class="type">integer</code>1122      </p>1123      <p>1124       Process ID of the leader apply worker if this process is a parallel1125       apply worker; NULL if this process is a leader apply worker or a1126       synchronization worker1127      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1128       <code class="structfield">relid</code> <code class="type">oid</code>1129      </p>1130      <p>1131       OID of the relation that the worker is synchronizing; NULL for the1132       leader apply worker and parallel apply workers1133      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1134       <code class="structfield">received_lsn</code> <code class="type">pg_lsn</code>1135      </p>1136      <p>1137       Last write-ahead log location received, the initial value of1138       this field being 0; NULL for parallel apply workers1139      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1140       <code class="structfield">last_msg_send_time</code> <code class="type">timestamp with time zone</code>1141      </p>1142      <p>1143       Send time of last message received from origin WAL sender; NULL for1144       parallel apply workers1145      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1146       <code class="structfield">last_msg_receipt_time</code> <code class="type">timestamp with time zone</code>1147      </p>1148      <p>1149       Receipt time of last message received from origin WAL sender; NULL for1150       parallel apply workers1151      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1152       <code class="structfield">latest_end_lsn</code> <code class="type">pg_lsn</code>1153      </p>1154      <p>1155       Last write-ahead log location reported to origin WAL sender; NULL for1156       parallel apply workers1157      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1158       <code class="structfield">latest_end_time</code> <code class="type">timestamp with time zone</code>1159      </p>1160      <p>1161       Time of last write-ahead log location reported to origin WAL1162       sender; NULL for parallel apply workers1163      </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="MONITORING-PG-STAT-SUBSCRIPTION-STATS"><div class="titlepage"><div><div><h3 class="title">28.2.9. <code class="structname">pg_stat_subscription_stats</code> <a href="#MONITORING-PG-STAT-SUBSCRIPTION-STATS" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.13.2" class="indexterm"></a><p>1164   The <code class="structname">pg_stat_subscription_stats</code> view will contain1165   one row per subscription.1166  </p><div class="table" id="PG-STAT-SUBSCRIPTION-STATS"><p class="title"><strong>Table 28.19. <code class="structname">pg_stat_subscription_stats</code> View</strong></p><div class="table-contents"><table class="table" summary="pg_stat_subscription_stats View" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">1167       Column Type1168      </p>1169      <p>1170       Description1171      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">1172       <code class="structfield">subid</code> <code class="type">oid</code>1173      </p>1174      <p>1175       OID of the subscription1176      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1177       <code class="structfield">subname</code> <code class="type">name</code>1178      </p>1179      <p>1180       Name of the subscription1181      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1182       <code class="structfield">apply_error_count</code> <code class="type">bigint</code>1183      </p>1184      <p>1185       Number of times an error occurred while applying changes1186      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1187       <code class="structfield">sync_error_count</code> <code class="type">bigint</code>1188      </p>1189      <p>1190       Number of times an error occurred during the initial table1191       synchronization1192      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">1193       <code class="structfield">stats_reset</code> <code class="type">timestamp with time zone</code>1194      </p>1195      <p>1196       Time at which these statistics were last reset1197      </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="MONITORING-PG-STAT-SSL-VIEW"><div class="titlepage"><div><div><h3 class="title">28.2.10. <code class="structname">pg_stat_ssl</code> <a href="#MONITORING-PG-STAT-SSL-VIEW" class="id_link">#</a></h3></div></div></div><a id="id-1.6.15.7.14.2" class="indexterm"></a><p>1198   The <code class="structname">pg_stat_ssl</code> view will contain one row per1199   backend or WAL sender process, showing statistics about SSL usage on1200   this connection. It can be joined to <code class="structname">pg_stat_activity</code>

Showing the first 1,200 of 2796 lines. Download the file for the rest.

codekingpro/portable-devtools · Team Ai