From 25c847ccfb493d548eb3e9af2a3d88b99fdf2a2d Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Thu, 22 Oct 2026 04:17:46 +0000
Subject: [PATCH v4 2/8] Describe buffer access strategy types in the glossary

The glossary explains the purpose and mechanics of buffer access strategies,
but not the available strategy types.

Describe normal, bulkread, bulkwrite, and vacuum, including operations that
may use the ring-based types. Update related documentation to use the strategy
names.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Sami Imseih <samimseih.pg@gmail.com>
Discussion: https://postgr.es/m/auCYYbDyrQEwIsQq@bdtpg
---
 doc/src/sgml/glossary.sgml           | 63 +++++++++++++++++++++++-----
 doc/src/sgml/tablesample-method.sgml |  2 +-
 2 files changed, 54 insertions(+), 11 deletions(-)
 100.0% doc/src/sgml/

diff --git a/doc/src/sgml/glossary.sgml b/doc/src/sgml/glossary.sgml
index d28a3729188..223f90076db 100644
--- a/doc/src/sgml/glossary.sgml
+++ b/doc/src/sgml/glossary.sgml
@@ -315,13 +315,14 @@
    <glossdef>
     <para>
      Some operations will access a large number of
-     <glossterm linkend="glossary-data-page">pages</glossterm>.  A
-     <firstterm>Buffer Access Strategy</firstterm> helps to prevent these
-     operations from evicting too many pages from
+     <glossterm linkend="glossary-data-page">pages</glossterm>.  Using a
+     strategy ring helps to prevent these operations from evicting too many
+     pages from
      <glossterm linkend="glossary-shared-memory">shared buffers</glossterm>.
     </para>
     <para>
-     A Buffer Access Strategy sets up references to a limited number of
+     Except for <literal>normal</literal>, each Buffer Access Strategy sets up
+     references to a limited number of
      <glossterm linkend="glossary-shared-memory">shared buffers</glossterm> and
      reuses them circularly.  When the operation requires a new page, a victim
      buffer is chosen from the buffers in the strategy ring, which may require
@@ -329,12 +330,54 @@
      <glossterm linkend="glossary-wal">WAL</glossterm> to permanent storage.
     </para>
     <para>
-     Buffer Access Strategies are used for various operations such as
-     sequential scans of large tables, <command>VACUUM</command>,
-     <command>COPY</command>, <command>CREATE TABLE AS SELECT</command>,
-     <command>ALTER TABLE</command>, <command>CREATE DATABASE</command>,
-     <command>CREATE INDEX</command>, and <command>CLUSTER</command>.
-    </para>
+     The available buffer access strategy types are:
+    </para>
+    <variablelist>
+     <varlistentry>
+      <term><literal>normal</literal></term>
+      <listitem>
+       <para>
+        Uses the normal clock-sweep buffer replacement policy without a
+        strategy ring.
+       </para>
+      </listitem>
+     </varlistentry>
+     <varlistentry>
+      <term><literal>bulkread</literal></term>
+      <listitem>
+       <para>
+        Uses a strategy ring for operations expected to read many pages with
+        little reuse. It may be used by large sequential scans and commands
+        such as <command>ALTER TABLE</command>,
+        <command>CREATE DATABASE</command>, <command>CREATE INDEX</command>,
+        and <command>CLUSTER</command>.
+       </para>
+      </listitem>
+     </varlistentry>
+     <varlistentry>
+      <term><literal>bulkwrite</literal></term>
+      <listitem>
+       <para>
+        Uses a strategy ring for operations that write many pages. It may be
+        used by <command>COPY FROM</command>,
+        <command>CREATE TABLE AS SELECT</command>,
+        <command>ALTER TABLE</command>, and
+        <command>CREATE DATABASE</command>.
+       </para>
+      </listitem>
+     </varlistentry>
+     <varlistentry>
+      <term><literal>vacuum</literal></term>
+      <listitem>
+       <para>
+        Uses a strategy ring for maintenance operations such as
+        <command>VACUUM</command> and <command>ANALYZE</command>. Its size can
+        be controlled with
+        <xref linkend="guc-vacuum-buffer-usage-limit"/>.
+       </para>
+      </listitem>
+     </varlistentry>
+    </variablelist>
    </glossdef>
   </glossentry>
 
diff --git a/doc/src/sgml/tablesample-method.sgml b/doc/src/sgml/tablesample-method.sgml
index c821941b71b..8465005a3d7 100644
--- a/doc/src/sgml/tablesample-method.sgml
+++ b/doc/src/sgml/tablesample-method.sgml
@@ -202,7 +202,7 @@ BeginSampleScan (SampleScanState *node,
    This function may adjust the fields <literal>node-&gt;use_bulkread</literal>
    and <literal>node-&gt;use_pagemode</literal>.
    If <literal>node-&gt;use_bulkread</literal> is <literal>true</literal>, which it is by
-   default, the scan will use a buffer access strategy that encourages
+   default, the scan will use a <literal>bulkread</literal> buffer access strategy that encourages
    recycling buffers after use.  It might be reasonable to set this
    to <literal>false</literal> if the scan will visit only a small fraction of the
    table's pages.
-- 
2.34.1

