From 2399651ef9587242e7e4682608e1e270ce0ba7a6 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Thu, 18 Jun 2026 14:21:13 +0800
Subject: [PATCH v3] doc: Clarify pgbench reporting with --continue-on-error

Clarify that transactions failed under --continue-on-error are reported
separately and are not counted as transactions actually processed or in
TPS. Also adjust the latency description to avoid implying that failed
transactions are generally included in latency measurements.

Author: Chao Li <lic@highgo.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/597C9755-4386-488D-A289-16D50AD81FBF@gmail.com
---
 doc/src/sgml/ref/pgbench.sgml | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index 2e401d1ceb8..9688527c955 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -770,10 +770,15 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
         the connection to fail.
         See <xref linkend="failures-and-retries"/> for more information.
        </para>
+
        <para>
         This option is useful when your custom script may raise errors
         such as unique constraint violations, but you want the benchmark
-        to continue and measure performance including those failures.
+        to continue despite individual statement failures.  Failed
+        transactions are reported separately, but are not counted as
+        transactions actually processed; time spent on failed transactions
+        remains part of the benchmark duration, so such failures can lower
+        the reported TPS.
        </para>
       </listitem>
      </varlistentry>
@@ -2933,9 +2938,17 @@ statement latencies in milliseconds, failures and retries:
 
   <para>
    The latency of a successful transaction includes the entire time of
-   transaction execution with rollbacks and retries. The latency is measured
-   only for successful transactions and commands but not for failed transactions
-   or commands.
+   transaction execution with rollbacks and retries.  In the main report,
+   when neither <option>--progress</option>, <option>--rate</option>, nor
+   <option>--latency-limit</option> is specified, the
+   <literal>latency average</literal> is computed from the total benchmark
+   duration divided by both successful and failed transactions, and therefore
+   includes failed transactions.  Otherwise, the <literal>latency
+   average</literal> and <literal>latency stddev</literal> shown in the main
+   report are measured only for successful transactions.  Detailed latency
+   statistics, including the per-script and per-command reports, are also
+   measured only for successful transactions and commands, not for failed
+   transactions or commands.
   </para>
 
   <para>
-- 
2.50.1 (Apple Git-155)

