<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 will normally be
pages from relations not belonging to the current database. This means
that there may not be matching join rows in <structname>pg_class</structname> for
some rows, or that there could even be incorrect joins. If you are
trying to join against <structname>pg_class</structname>, it's a good idea to
restrict the join to rows having <structfield>reldatabase</structfield> equal to
the current database's OID or zero.
</para>
<para>
Since buffer manager locks are not taken to copy the buffer state data that
the view will display, accessing <structname>pg_buffercache</structname> view
has less impact on normal buffer activity but it doesn't provide a consistent
set of results across all buffers. However, we ensure that the information of
each buffer is self-consistent.
</para>
</sect2>
<sect2 id="pgbuffercache-pg-buffercache-numa">
<title>The <structname>pg_buffercache_numa</structname> View</title>
<para>
The definitions of the columns exposed by the view are shown in <xref linkend="pgbuffercache-numa-columns"/>.
</para>
<table id="pgbuffercache-numa-columns">
<title><structname>pg_buffercache_numa</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>os_page_num</structfield> <type>bigint</type>
</para>
<para>
number of OS memory page for this buffer
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>numa_node</structfield> <type>int</type>
</para>
<para>
ID of <acronym>NUMA</acronym> node
</para></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
As <acronym>NUMA</acronym> node ID inquiry for each page requires memory pages
to be paged-in, the first execution of this function can take a noticeable
amount of time. In all the cases (first execution or not), retrieving this
information is costly and querying the view at a high frequency is not recommended.
</para>
<warning>
<para>
When determining the <acronym>NUMA</acronym> node, the view touches
all memory pages for the shared memory segment. This will force
allocation of the shared memory, if it wasn't allocated already,
and the memory may get allocated in a single <acronym>NUMA</acronym>
node (depending on system configuration).
</para>
</warning>