Re: doc: explain pgstatindex fragmentation

From: Benoit Lobréau <benoit(dot)lobreau(at)dalibo(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: doc: explain pgstatindex fragmentation
Date: 2025-01-27 09:13:39
Message-ID: 431561c7-b0a1-4da5-b794-366c302321d4@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/25/25 7:07 PM, Laurenz Albe wrote:
> Looks good to me. I have one question left: the explanation for the performance
> penalty of a high leaf fragmentation sounds like it would only be relevant for
> disks where sequential reads are faster. If that is correct, perhaps it would be
> worth mentioning.

Hi Laurenz,

Frédéric is in holiday this week. So he might not be able to answer,
I'll try to do it in his stead.

Frederic noticed a performance hit even for on his laptop with a SSD.

On Fri, 2025-01-24 at 15:41 +0100, Frédéric Yhuel wrote:
> I've noticed that maximum leaf_fragmentation can have a huge impact on
> a range index-only scan, when reading all blocs from disks, even on my
> laptop machine with SSD, but I don't know if this is the right place
> to document this?

He reported to our team, that he did a test with two indexes on the same
data. They had the same density but one had no fragmentation while the
other had 100%. He got an execution time of ~90ms (0 frag) vs ~340ms
100% frag).

I get similar result with my laptor (except my disk is significantly
worse: ~152ms vs ~833ms).

Here are the scripts.

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

Attachment Content-Type Size
evict_from_both_caches.sql application/sql 618 bytes
leaf_fragmentation.sql application/sql 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2025-01-27 09:21:39 Re: doc: explain pgstatindex fragmentation
Previous Message Jelte Fennema-Nio 2025-01-27 09:05:54 Re: New process of getting changes into the commitfest app