]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Expose wal_fpi_bytes in EXPLAIN (WAL)
authorMichael Paquier <michael@paquier.xyz>
Thu, 30 Oct 2025 06:34:01 +0000 (15:34 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 30 Oct 2025 06:34:01 +0000 (15:34 +0900)
The new wal_fpi_bytes counter calculates the total amount of full page
images inserted in WAL records, in bytes.  This commit exposes this
information in EXPLAIN (ANALYZE, WAL) alongside the existing counters,
for both the text and JSON/YAML outputs, building upon f9a09aa29520.

Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discusssion: https://postgr.es/m/CAOzEurQtZEAfg6P0kU3Wa-f9BWQOi0RzJEMPN56wNTOmJLmfaQ@mail.gmail.com

doc/src/sgml/ref/explain.sgml
src/backend/commands/explain.c

index 6dda680aa0de8ff5af5f6ede9e78ac836d3fc552..7dee77fd366b0693d82bddf107c733654011150d 100644 (file)
@@ -241,7 +241,8 @@ ROLLBACK;
      <para>
       Include information on WAL record generation. Specifically, include the
       number of records, number of full page images (fpi), the amount of WAL
-      generated in bytes and the number of times the WAL buffers became full.
+      generated in bytes, the amount of full page images generated in bytes,
+      and the number of times the WAL buffers became full.
       In text format, only non-zero values are printed.
       This parameter may only be used when <literal>ANALYZE</literal> is also
       enabled.  It defaults to <literal>FALSE</literal>.
index e6edae0845cb06b880213d5cfc6869465dd85cd0..7e699f8595e03d39115284a163361284d7f870f4 100644 (file)
@@ -4283,7 +4283,8 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
        {
                /* Show only positive counter values. */
                if ((usage->wal_records > 0) || (usage->wal_fpi > 0) ||
-                       (usage->wal_bytes > 0) || (usage->wal_buffers_full > 0))
+                       (usage->wal_bytes > 0) || (usage->wal_buffers_full > 0) ||
+                       (usage->wal_fpi_bytes > 0))
                {
                        ExplainIndentText(es);
                        appendStringInfoString(es->str, "WAL:");
@@ -4297,6 +4298,9 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
                        if (usage->wal_bytes > 0)
                                appendStringInfo(es->str, " bytes=%" PRIu64,
                                                                 usage->wal_bytes);
+                       if (usage->wal_fpi_bytes > 0)
+                               appendStringInfo(es->str, " fpi bytes=%" PRIu64,
+                                                                usage->wal_fpi_bytes);
                        if (usage->wal_buffers_full > 0)
                                appendStringInfo(es->str, " buffers full=%" PRId64,
                                                                 usage->wal_buffers_full);
@@ -4311,6 +4315,8 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
                                                           usage->wal_fpi, es);
                ExplainPropertyUInteger("WAL Bytes", NULL,
                                                                usage->wal_bytes, es);
+               ExplainPropertyUInteger("WAL FPI Bytes", NULL,
+                                                               usage->wal_fpi_bytes, es);
                ExplainPropertyInteger("WAL Buffers Full", NULL,
                                                           usage->wal_buffers_full, es);
        }