Re: [WiP] B-tree page merge during vacuum to reduce index bloat

From: Madhav Madhusoodanan <madhavmadhusoodanan(at)gmail(dot)com>
To: Kirk Wolak <wolakk(at)gmail(dot)com>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>
Subject: Re: [WiP] B-tree page merge during vacuum to reduce index bloat
Date: 2026-02-27 09:54:37
Message-ID: CAKw2Pb3fjYag1MUAHLOx+tj42+UXMKf3xGz9paDCTZuaXPFwZQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 27, 2026 at 2:33 AM Madhav Madhusoodanan
<madhavmadhusoodanan(at)gmail(dot)com> wrote:
>
> On Tue, Aug 26, 2025 at 2:11 PM Kirk Wolak <wolakk(at)gmail(dot)com> wrote:
> > I do have a question, one of the IDEAS we discussed was to ADD a new page that combined the 2 pages.
>
> Would the flow then be as follows? Please correct me if I'm wrong:
> Start: Parent page P, with adjacent child pages A -> B -> C -> D.
> Pages B and C are sparse enough and are about to be merged.
> 1: Acquire lock on pages B and C
> 2: Create a new page N, which copies the tuples in pages B and C
> 3: Acquire lock on parent page P, update the separator keys in P,
> release lock on P
> 4: Update pointers such that pages link like so: A -> N -> D
> 5: Release lock on pages B and C
>
> Regards,
>
> Madhav

On a related note, I noticed the same topic on the 2026 projects list
in the Google Summer of Code page. It mentions that a prototype
extension (pg_btree_compact) has been developed. How do I access the
same?

Thanks in advance!

Madhav

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-02-27 10:00:00 Re: Use pg_malloc macros in src/fe_utils
Previous Message Yasuo Honda 2026-02-27 09:51:02 [PATCH] Fix unexpected loss of DEFERRABLE property after toggling NOT ENFORCED / ENFORCED