Thanks, that makes sense. It was going to be my third guess, but it
seemed pretty wide for a TOAST pointer. Reviewing what goes in there,
though, it's reasonable.
I assume that this means for unTOASTed but compressed data, this
counts the compressed size.
Would a doc patch clarifying this (and possibly linking to the
relevant TOAST docs [1]) be welcome? The current wording is pretty
vague. Something like
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 7c09ab3000..2814ac8007 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -7466,7 +7466,9 @@ SCRAM-SHA-256$<replaceable><iteration
count></replaceable>:<replaceable>&l
<structfield>stawidth</structfield> <type>int4</type>
</para>
<para>
- The average stored width, in bytes, of nonnull entries
+ The average stored width, in bytes, of nonnull entries. For compressed
+ entries, counts the compressed size; for TOASTed data, the size of the
+ TOAST pointer (see <link linkend="storage-toast">TOAST</link>).
</para></entry>
</row>
diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index bb1a418450..62184fe32b 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -3680,7 +3680,9 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
<structfield>avg_width</structfield> <type>int4</type>
</para>
<para>
- Average width in bytes of column's entries
+ Average width in bytes of column's entries. For compressed entries,
+ counts the compressed size; for TOASTed data, the size of the TOAST
+ pointer (see <link linkend="storage-toast">TOAST</link>).
</para></entry>
</row>
(not sure if this should be <link /> or <xref />).
Thanks,
Maciek
[1]: https://www.postgresql.org/docs/current/storage-toast.html