From dad557ab42420b7c390f81034029a8aabbc1de71 Mon Sep 17 00:00:00 2001
From: Sami Imseih <simseih@amazon.com>
Date: Fri, 11 Apr 2025 11:51:41 -0500
Subject: [PATCH v3 1/1] Clarify when aborted rows are tracked for tuple
 related counters.

It is not obvious from the statistics collector documentation that
tuple-related counters are incremented even when a transaction aborts,
except for the n_mod_since_analyze counter, which only counts committed
rows. Update the documentation to clarify this behavior.
---
 doc/src/sgml/monitoring.sgml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index c421d89edff..4f39f904ca2 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -278,6 +278,10 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
    stated above; instead they update continuously throughout the transaction.
   </para>
 
+  <para>
+   An aborted transaction will also increment tuple-related counters, unless otherwise noted.
+  </para>
+
   <para>
    Some of the information in the dynamic statistics views shown in <xref
    linkend="monitoring-stats-dynamic-views-table"/> is security restricted.
@@ -3947,7 +3951,8 @@ description | Waiting for a newly initialized WAL file to reach durable storage
        <structfield>n_live_tup</structfield> <type>bigint</type>
       </para>
       <para>
-       Estimated number of live rows
+       Estimated number of live rows (updated by committed transactions, or by
+       <command>VACUUM</command> and <command>VACUUM FULL</command>)
       </para></entry>
      </row>
 
@@ -3956,7 +3961,8 @@ description | Waiting for a newly initialized WAL file to reach durable storage
        <structfield>n_dead_tup</structfield> <type>bigint</type>
       </para>
       <para>
-       Estimated number of dead rows
+       Estimated number of dead rows (updated by committed transactions, or by
+       <command>VACUUM</command> and <command>VACUUM FULL</command>)
       </para></entry>
      </row>
 
@@ -3966,6 +3972,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
       </para>
       <para>
        Estimated number of rows modified since this table was last analyzed
+       (this only includes rows from commited transactions)
       </para></entry>
      </row>
 
-- 
2.39.5 (Apple Git-154)

