Re: BRIN autosummarization lacking a snapshot
Álvaro Herrera <alvherre@kurilemu.de>
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Michael Paquier <michael@paquier.xyz>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-04T14:22:20Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix snapshot handling bug in recent BRIN fix
- ef81697fee77 13.23 landed
- bcfbd3f747d7 15.15 landed
- 8733f0b54c05 18.1 landed
- 65b0d1f74098 14.20 landed
- 3b5007347b5d 17.7 landed
- 20442cf5075d 16.11 landed
- 0a3d27bfe0fb 19 (unreleased) landed
-
BRIN autosummarization may need a snapshot
- f4b68b0336bd 17.7 landed
- f0ad41716197 14.20 landed
- a95e3d84c0e0 19 (unreleased) landed
- 6ef33c8051dd 16.11 landed
- 419ffde23546 18.1 landed
- 3c7b47974ec7 13.23 landed
- 23ddadf6835e 15.15 landed
> With my initial try of this test, just counting the number of BRIN > tuples, I was _really_ surprised that the index did indeed contain the > expected number of tuples, even when the error was being thrown. This > turned out to be expected, because the way BRIN summarization works is > that we insert a placeholder tuple first, then update it to the correct > value, and the error only aborts the second part. One thing that's not fully clear to me, but will test later, is that if this has happened to you, then the placeholder tuple remains in place and doesn't ever become non-placeholder. If vacuum (incl. autovacuum) sees such a tuple, it will gladly ignore the page range, as if it were already summarized. This makes your index scans potentially inefficient, because for placeholder tuples bringetbitmap will always include the affected page range. I think we should make vacuum clean it up somehow, but I'm not yet sure how safe it is. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "El Maquinismo fue proscrito so pena de cosquilleo hasta la muerte" (Ijon Tichy en Viajes, Stanislaw Lem)