doc: explain pgstatindex fragmentation

Started by Benoit Lobréau12 months ago3 messages
#1Benoit Lobréau
benoit.lobreau@dalibo.com

Hi,

I like the clarification but I think that:

A higher <literal>leaf_fragmentation</literal> indicates that the
physical order of the index leaf
pages increasingly deviates from their logical order.

Would be cleaner than:

The higher <literal>leaf_fragmentation</literal> is, the less the
physical order
of the index leaf pages corresponds to the logical order we would have
just after
a <command>REINDEX</command>.

--
Benoit Lobréau
Consultant
http://dalibo.com

#2Benoit Lobréau
benoit.lobreau@dalibo.com
In reply to: Benoit Lobréau (#1)
1 attachment(s)
Re: doc: explain pgstatindex fragmentation

Here is an updated patch to save you some time.

--
Benoit Lobréau
Consultant
http://dalibo.com

Attachments:

0001-doc-explain-pgstatindex-fragmentation.patchtext/x-patch; charset=UTF-8; name=0001-doc-explain-pgstatindex-fragmentation.patchDownload
From 5d89ca0a36e98d1e5be858166a8394c09e0fa129 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?= <frederic.yhuel@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

#3Frédéric Yhuel
frederic.yhuel@dalibo.com
In reply to: Benoit Lobréau (#2)
Re: doc: explain pgstatindex fragmentation

On 1/22/25 10:24, Benoit Lobréau wrote:

Here is an updated patch to save you some time.

Thanks ! it does seems better that way.