Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/pgbuffercache.sgml`
01b07fc679f73e282d9abccca7cf3fa045d2b8275c11e91c0000000100000fa0
 buffers in the relation to be evicted from the buffer pool
  given a relation identifier.  Use of this function is restricted to
  superusers only.
 </para>

 <para>
  The <function>pg_buffercache_evict_all()</function> function allows all
  unpinned shared buffers to be evicted in the buffer pool.  Use of this
  function is restricted to superusers only.
 </para>

 <sect2 id="pgbuffercache-pg-buffercache">
  <title>The <structname>pg_buffercache</structname> View</title>

  <para>
   The definitions of the columns exposed by the view are shown in <xref linkend="pgbuffercache-columns"/>.
  </para>

  <table id="pgbuffercache-columns">
   <title><structname>pg_buffercache</structname> Columns</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>bufferid</structfield> <type>integer</type>
      </para>
      <para>
       ID, in the range 1..<varname>shared_buffers</varname>
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>relfilenode</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relfilenode</structfield>)
      </para>
      <para>
       Filenode number of the relation
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>reltablespace</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       Tablespace OID of the relation
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>reldatabase</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       Database OID of the relation
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>relforknumber</structfield> <type>smallint</type>
      </para>
      <para>
       Fork number within the relation;  see
       <filename>common/relpath.h</filename>
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>relblocknumber</structfield> <type>bigint</type>
      </para>
      <para>
       Page number within the relation
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>isdirty</structfield> <type>boolean</type>
      </para>
      <para>
       Is the page dirty?
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>usagecount</structfield> <type>smallint</type>
      </para>
      <para>
       Clock-sweep access count
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>pinning_backends</structfield> <type>integer</type>
      </para>
      <para>
       Number of backends pinning this buffer
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

  <para>
   There is one row for each buffer in the shared cache. Unused buffers are
   shown with all fields null except <structfield>bufferid</structfield>.  Shared system
   catalogs are shown as belonging to database zero.
  </para>

  <para>
   Because the cache is shared by all the databases, there

Title: The pg_buffercache View
Summary
The pg_buffercache view provides detailed information about the shared buffer cache in PostgreSQL, including buffer IDs, relation identifiers, tablespace and database OIDs, fork and block numbers, dirty page status, usage counts, and pinning backend information, with one row for each buffer in the cache.