[PATCH] Improve HASH overflow page reuse for better locality

Started by lakshmi2 days ago1 messageshackers
Jump to latest
#1lakshmi
lakshmigcdac@gmail.com

Hi all,

Based on the suggestion in the previous discussion [1]/messages/by-id/CALdSSPgu6fnoOYzgiFF4_Etr96zEHvSwvYJDemc3o++EZbUQMA@mail.gmail.com, I am starting a
separate thread to propose this as an enhancement.

While testing the HASH index build improvements, I worked on a follow-up
change to improve overflow page reuse. Currently, any free overflow page
may be reused, which can scatter overflow chains and affect cache locality.
This patch introduces a simple improvement where recently freed overflow
pages are preferred during allocation.

The change is backend-local and affects only page allocation. It does not
introduce any WAL changes or modify the on-disk format.

I have verified correctness using index build, drop, and VACUUM cycles.
Initial checks also confirm that WAL behavior remains unchanged.

I am currently working on collecting detailed performance results,
including both favorable and unfavorable scenarios, and will share them
shortly in this thread.

The patch is attached for review. Feedback and suggestions are welcome.

Regards,
Lakshmi G

reference

[1]: /messages/by-id/CALdSSPgu6fnoOYzgiFF4_Etr96zEHvSwvYJDemc3o++EZbUQMA@mail.gmail.com
/messages/by-id/CALdSSPgu6fnoOYzgiFF4_Etr96zEHvSwvYJDemc3o++EZbUQMA@mail.gmail.com

Attachments:

0001-hash-reuse-recently-freed-overflow-pages.patchtext/x-patch; charset=US-ASCII; name=0001-hash-reuse-recently-freed-overflow-pages.patchDownload+77-1