Re: Use log_newpage_range in HASH index build

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: lakshmi <lakshmigcdac@gmail.com>
Cc: Kirill Reshke <reshkekirill@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-04-26T17:12:06Z
Lists: pgsql-hackers
On Mon, Jan 5, 2026 at 3:48 AM lakshmi <lakshmigcdac@gmail.com> wrote:
> Following up on my earlier note, I implemented the proposed HASH overflow page reuse enhancement.Recently freed overflow pages are recorded in
> _hash_freeovflpage( ),and _hash_addovflpage( ) now prefers reusing those pages during allocation before falling back to the bitmap scan.
>
> The change is backend-local and allocation-only,with no WAL or on-disk format changes.I verified correctness using index build/drop and VACUUM cycles,and confirmed WAL neutrality by comparing WAL generated during HASH index builds with and without this change (no  observable difference beyond normal noise).
>
> The patch is attached for review.Feedback is welcome.

It is probably best to start a separate email thread specifically
about this patch, because it's doing something quite different from
the original patch. I suggest presenting some specific performance
results, as it's not very clear how much benefit this might have. It
might be good to test a favorable scenario and also an unfavorable
scenario, describing and showing results for each.

-- 
Robert Haas
EDB: http://www.enterprisedb.com