Home Explore Blog CI



postgresql

11th chunk of `doc/src/sgml/monitoring.sgml`
26c285ca23b690f7a2b92c899004160b73625adc484c2e030000000100000fa0
 <entry><structname>pg_statio_user_sequences</structname><indexterm><primary>pg_statio_user_sequences</primary></indexterm></entry>
      <entry>Same as <structname>pg_statio_all_sequences</structname>, except that only
      user sequences are shown.</entry>
     </row>

    </tbody>
   </tgroup>
  </table>

  <para>
   The per-index statistics are particularly useful to determine which
   indexes are being used and how effective they are.
  </para>

  <para>
   The <structname>pg_stat_io</structname> and
   <structname>pg_statio_</structname> set of views are useful for determining
   the effectiveness of the buffer cache. They can be used to calculate a cache
   hit ratio. Note that while <productname>PostgreSQL</productname>'s I/O
   statistics capture most instances in which the kernel was invoked in order
   to perform I/O, they do not differentiate between data which had to be
   fetched from disk and that which already resided in the kernel page cache.
   Users are advised to use the <productname>PostgreSQL</productname>
   statistics views in combination with operating system utilities for a more
   complete picture of their database's I/O performance.
  </para>

 </sect2>

 <sect2 id="monitoring-pg-stat-activity-view">
  <title><structname>pg_stat_activity</structname></title>

  <indexterm>
   <primary>pg_stat_activity</primary>
  </indexterm>

  <para>
   The <structname>pg_stat_activity</structname> view will have one row
   per server process, showing information related to
   the current activity of that process.
  </para>

  <table id="pg-stat-activity-view" xreflabel="pg_stat_activity">
   <title><structname>pg_stat_activity</structname> View</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>datid</structfield> <type>oid</type>
      </para>
      <para>
       OID of the database this backend is connected to
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>datname</structfield> <type>name</type>
      </para>
      <para>
       Name of the database this backend is connected to
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>pid</structfield> <type>integer</type>
      </para>
      <para>
       Process ID of this backend
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>leader_pid</structfield> <type>integer</type>
      </para>
      <para>
       Process ID of the parallel group leader if this process is a parallel
       query worker, or process ID of the leader apply worker if this process
       is a parallel apply worker.  <literal>NULL</literal> indicates that this
       process is a parallel group leader or leader apply worker, or does not
       participate in any parallel operation.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>usesysid</structfield> <type>oid</type>
      </para>
      <para>
       OID of the user logged into this backend
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>usename</structfield> <type>name</type>
      </para>
      <para>
       Name of the user logged into this backend
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>application_name</structfield> <type>text</type>
      </para>
      <para>
       Name of the application that is connected

Title: I/O Statistics and Process Activity Monitoring
Summary
The section discusses I/O statistics views, emphasizing the importance of per-index statistics and how to use the views to calculate cache hit ratios. It also introduces the pg_stat_activity view, which provides information about the current activity of each server process. The view includes details such as the database OID and name, process ID, user OID and name, and application name.