From f42cada1a6ea56f671037b2eae556914b35a6850 Mon Sep 17 00:00:00 2001
From: Sami Imseih <samimseih.pg@gmail.com>
Date: Thu, 10 Sep 2026 03:12:06 +0000
Subject: [PATCH v1 1/1] doc: document pg_stat_force_next_flush()

pg_stat_force_next_flush() has primarily been used in in-core tests to
force cumulative statistics to be flushed at the end of a transaction
without waiting for the PGSTAT_MIN_INTERVAL throttle. It is also
useful in tests outside the core tree, so document it in the
monitoring statistics function reference.
---
 doc/src/sgml/monitoring.sgml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 48db5aec350..6a4cb9bb144 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -5936,6 +5936,24 @@ description | Waiting for a newly initialized WAL file to reach durable storage
        </para></entry>
       </row>
 
+      <row>
+       <entry role="func_table_entry"><para role="func_signature">
+        <indexterm>
+         <primary>pg_stat_force_next_flush</primary>
+        </indexterm>
+        <function>pg_stat_force_next_flush</function> ()
+        <returnvalue>void</returnvalue>
+       </para>
+       <para>
+        Forces the statistics accumulated by the current session to be
+        flushed to shared memory when the current transaction ends,
+        without waiting for the
+        <varname>PGSTAT_MIN_INTERVAL</varname> delay between flushes. This
+        is mainly useful in tests that need this flush to happen without
+        that delay.
+       </para></entry>
+      </row>
+
       <row>
        <entry role="func_table_entry"><para role="func_signature">
         <indexterm>
-- 
2.50.1

