| From: | Tomas Vondra <tomas(at)vondra(dot)me> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: BRIN re-summarization is not properly logging snapshotConflictHorizon / wrong results on hot standby |
| Date: | 2026-12-06 15:21:49 |
| Message-ID: | b15dcc4f-ee9b-4bc8-ad9b-fc14c2b4fb18@vondra.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 12/6/26 16:11, Tomas Vondra wrote:
> ...
>
> So what can ve do about this on backbranches? I have two rough ideas
> that I think would be acceptable:
>
> a) For summarizing indexes, summarize even the DEAD tuples.
>
> That is not great, as the index will match more rows, but it's also
> fairly cheap as the summaries are cheap (much cheaper than regular index
> entries). If needed, people could still vacuum the table first, which
> deletes the rows (and does proper WAL-logging of the horizon). After
> that, there are no dead tuples, and the summary won't include them.
>
> b) Piggy-back on ii_BrokenHotChain / indcheckxmin somehow?
>
> We do have a somewhat related capability during index (re)builds, using
> indcheckxmin and ii_BrokenHotChain. Maybe we could piggy-back on that
> somehow. But not sure if that's feasible.
>
Ah, a minute after sending the e-mail I realized there's a bit of an
overlap with some recent threads, e.g. [1]. I initially considered it a
separate issue, but I now realize it could help BRIN too:
1) It adds LogStandbySnapshotConflict to heapam_index_build_range_scan,
and that's what BRIN uses for summarization, so AFAIK this alone would
be enough to fix the issue.
2) AFAICS we could use LogStandbySnapshotConflict() in BRIN code, and
we'd be able to WAL-log the horizon without a new WAL record. So it
would be backpatchable.
regards
--
Tomas Vondra
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dave Sharpe | 2026-12-06 15:46:26 | [PATCH] Round fractional Julian days to the nearest microsecond |
| Previous Message | Tomas Vondra | 2026-12-06 15:11:59 | BRIN re-summarization is not properly logging snapshotConflictHorizon / wrong results on hot standby |