BRIN autosummarization may need a snapshot
authorÁlvaro Herrera <[email protected]>
Tue, 4 Nov 2025 12:23:26 +0000 (13:23 +0100)
committerÁlvaro Herrera <[email protected]>
Tue, 4 Nov 2025 12:23:26 +0000 (13:23 +0100)
commit419ffde235469bd7459bd52b7eeed76a7520853a
tree76b2ab2f28c27308e5ea22f9ad46e508664b1066
parent1baae827ef51ca12ac5cd83775905a46f8e794af
BRIN autosummarization may need a snapshot

It's possible to define BRIN indexes on functions that require a
snapshot to run, but the autosummarization feature introduced by commit
7526e10224f0 fails to provide one.  This causes autovacuum to leave a
BRIN placeholder tuple behind after a failed work-item execution, making
such indexes less efficient.  Repair by obtaining a snapshot prior to
running the task, and add a test to verify this behavior.

Author: Álvaro Herrera <[email protected]>
Reported-by: Giovanni Fabris <[email protected]>
Reported-by: Arthur Nascimento <[email protected]>
Backpatch-through: 13
Discussion: https://postgr.es/m/202511031106[email protected]
src/backend/postmaster/autovacuum.c
src/test/modules/brin/t/01_workitems.pl