Home Explore Blog CI



postgresql

14th chunk of `doc/src/sgml/monitoring.sgml`
53ef305ff984d4e69aa0a2eee749c2baf2380ce6cd57fd340000000100000fa4
 <literal>fastpath function call</literal>: The backend is executing a
          fast-path function.
         </para>
        </listitem>
        <listitem>
         <para>
          <literal>disabled</literal>: This state is reported if <xref linkend="guc-track-activities"/> is disabled in this backend.
         </para>
       </listitem>
       </itemizedlist>
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>backend_xid</structfield> <type>xid</type>
      </para>
      <para>
       Top-level transaction identifier of this backend, if any;  see
       <xref linkend="transaction-id"/>.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>backend_xmin</structfield> <type>xid</type>
      </para>
      <para>
       The current backend's <literal>xmin</literal> horizon.
      </para></entry>
     </row>

    <row>
     <entry role="catalog_table_entry"><para role="column_definition">
      <structfield>query_id</structfield> <type>bigint</type>
     </para>
     <para>
      Identifier of this backend's most recent query. If
      <structfield>state</structfield> is <literal>active</literal> this
      field shows the identifier of the currently executing query. In
      all other states, it shows the identifier of last query that was
      executed.  Query identifiers are not computed by default so this
      field will be null unless <xref linkend="guc-compute-query-id"/>
      parameter is enabled or a third-party module that computes query
      identifiers is configured.
     </para></entry>
    </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>query</structfield> <type>text</type>
      </para>
      <para>
       Text of this backend's most recent query. If
       <structfield>state</structfield> is <literal>active</literal> this field shows the
       currently executing query. In all other states, it shows the last query
       that was executed. By default the query text is truncated at 1024
       bytes; this value can be changed via the parameter
       <xref linkend="guc-track-activity-query-size"/>.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>backend_type</structfield> <type>text</type>
      </para>
      <para>
       Type of current backend. Possible types are
       <literal>autovacuum launcher</literal>, <literal>autovacuum worker</literal>,
       <literal>logical replication launcher</literal>,
       <literal>logical replication worker</literal>,
       <literal>parallel worker</literal>, <literal>background writer</literal>,
       <literal>client backend</literal>, <literal>checkpointer</literal>,
       <literal>archiver</literal>, <literal>standalone backend</literal>,
       <literal>startup</literal>, <literal>walreceiver</literal>,
       <literal>walsender</literal>, <literal>walwriter</literal> and
       <literal>walsummarizer</literal>.
       In addition, background workers registered by extensions may have
       additional types.
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

  <note>
   <para>
    The <structfield>wait_event</structfield> and <structfield>state</structfield> columns are
    independent.  If a backend is in the <literal>active</literal> state,
    it may or may not be <literal>waiting</literal> on some event.  If the state
    is <literal>active</literal> and <structfield>wait_event</structfield> is non-null, it
    means that a query is being executed, but is being blocked somewhere
    in the system.  To keep the reporting overhead low, the system does not
    attempt to synchronize different aspects of activity data for a backend.
    As a result, ephemeral discrepancies may exist between the view's columns.
   </para>
  </note>

Title: pg_stat_activity View: Query Details, Backend Type, and Important Notes
Summary
This section of the pg_stat_activity view provides details about the most recent query executed by the backend (query_id, query), the type of backend (backend_type), and includes a note emphasizing the independence of the wait_event and state columns, explaining that a backend can be active and waiting simultaneously, and highlighting the potential for ephemeral discrepancies between columns due to low reporting overhead.