pgsql: BRIN autosummarization may need a snapshot

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: BRIN autosummarization may need a snapshot
Date: 2025-11-04 12:24:42
Message-ID: E1vGG5a-004zIj-0V@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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 <alvherre(at)kurilemu(dot)de>
Reported-by: Giovanni Fabris <giovanni(dot)fabris(at)icon(dot)it>
Reported-by: Arthur Nascimento <tureba(at)gmail(dot)com>
Backpatch-through: 13
Discussion: https://postgr.es/m/202511031106.h4fwyuyui6fz@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a95e3d84c0e0ffd1e27c185dd69d053e43f2f8b5

Modified Files
--------------
src/backend/postmaster/autovacuum.c | 2 ++
src/test/modules/brin/t/01_workitems.pl | 46 ++++++++++++++++++++++++++++++---
2 files changed, 44 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2025-11-04 13:48:04 pgsql: Tighten check for generated column in partition key expression
Previous Message Peter Eisentraut 2025-11-04 11:38:47 pgsql: Error message stylistic correction