From 2e4679bcafafdf3ace60f771f730a226ee682034 Mon Sep 17 00:00:00 2001
From: Matthias van de Meent <boekewurm+postgres@gmail.com>
Date: Fri, 1 Mar 2024 14:23:06 +0100
Subject: [PATCH v9 2/2] Add EXPLAIN (SERIALIZE) docs

---
 doc/src/sgml/ref/explain.sgml | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml
index a4b6564bdb..a1524046b9 100644
--- a/doc/src/sgml/ref/explain.sgml
+++ b/doc/src/sgml/ref/explain.sgml
@@ -41,6 +41,7 @@ EXPLAIN [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] <rep
     SETTINGS [ <replaceable class="parameter">boolean</replaceable> ]
     GENERIC_PLAN [ <replaceable class="parameter">boolean</replaceable> ]
     BUFFERS [ <replaceable class="parameter">boolean</replaceable> ]
+    SERIALIZE [ { NONE | TEXT | BINARY } ]
     WAL [ <replaceable class="parameter">boolean</replaceable> ]
     TIMING [ <replaceable class="parameter">boolean</replaceable> ]
     SUMMARY [ <replaceable class="parameter">boolean</replaceable> ]
@@ -206,6 +207,34 @@ ROLLBACK;
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>SERIALIZE</literal></term>
+    <listitem>
+     <para>
+      Specifies whether the query's results should be serialized as if the
+      data was sent to the client using textual or binary representations.
+      If the value value is <literal>NONE</literal> we don't process output
+      tuples, so data from <acronym>TOAST</acronym>ed values is not accessed
+      and EXPLAIN timings may be unexpected.  If the value is
+      <literal>TEXT</literal> or <literal>BINARY</literal>,
+      <productname>PostgreSQL</productname> will measure the size of the
+      would-be transmitted data after serializing the rows to
+      <literal>DataRow</literal> packets, using each column type's
+      <literal>output</literal> (for <literal>TEXT</literal>) or
+      <literal>send</literal> (for <literal>BINARY</literal>) functions for
+      serializing the column's values.  When the <literal>TIMING</literal>
+      option is enabled, the output also includes how much time was spent to
+      serialize the data.  When the <literal>MEMORY</literal> option is
+      enabled, the output will also show how much memory was used and
+      allocated during serialization.
+      This parameter may only be used when <literal>ANALYZE</literal> is also
+      enabled.  The default value for this parameter is <literal>NONE</literal>,
+      but when <literal>SERIALIZE</literal> is provided without parameters,
+      <literal>TEXT</literal> is used instead.
+     </para>
+    </listitem>
+   </varlistentry>
+
    <varlistentry>
     <term><literal>WAL</literal></term>
     <listitem>
-- 
2.40.1

