Here is an updated patch to save you some time.

--
Benoit Lobréau
Consultant
http://dalibo.com
From 5d89ca0a36e98d1e5be858166a8394c09e0fa129 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?= <frederic.yh...@dalibo.com>
Date: Tue, 5 Nov 2024 17:59:44 +0100
Subject: [PATCH] doc: explain pgstatindex fragmentation

It was quite hard to guess what leaf_fragmentation meant without looking
at pgstattuple's code. This patch aims to give to the user a better
idea of what it means.
---
 doc/src/sgml/pgstattuple.sgml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/doc/src/sgml/pgstattuple.sgml b/doc/src/sgml/pgstattuple.sgml
index 4071da4ed94..280f1ac9ce8 100644
--- a/doc/src/sgml/pgstattuple.sgml
+++ b/doc/src/sgml/pgstattuple.sgml
@@ -277,6 +277,13 @@ leaf_fragmentation | 0
      page-by-page, and should not be expected to represent an
      instantaneous snapshot of the whole index.
     </para>
+
+    <para>
+     <literal>avg_leaf_density</literal> can be seen as the inverse of bloat,
+     while <literal>leaf_fragmentation</literal> represents a measure of disorder.
+     A higher <literal>leaf_fragmentation</literal> indicates that the physical
+     order of the index leaf pages increasingly deviates from their logical order.
+    </para>
     </listitem>
    </varlistentry>
 
-- 
2.48.1

Reply via email to