pgsql: Revert changes in HOT handling of BRIN indexes

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Revert changes in HOT handling of BRIN indexes
Date: 2022-06-16 13:03:56
Message-ID: E1o1pAC-000Klk-2t@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Revert changes in HOT handling of BRIN indexes

This reverts commits 5753d4ee32 and fe60b67250 that modified HOT to
ignore BRIN indexes. The commit message for 5753d4ee32 claims that:

When determining whether an index update may be skipped by using
HOT, we can ignore attributes indexed only by BRIN indexes. There
are no index pointers to individual tuples in BRIN, and the page
range summary will be updated anyway as it relies on visibility
info.

This is partially incorrect - it's true BRIN indexes don't point to
individual tuples, so HOT chains are not an issue, but the visibitlity
info is not sufficient to keep the index up to date. This can easily
result in corrupted indexes, as demonstrated in the hackers thread.

This does not mean relaxing the HOT restrictions for BRIN is a lost
cause, but it needs to handle the two aspects (allowing HOT chains and
updating the page range summaries) as separate. But that requires a
major changes, and it's too late for that in the current dev cycle.

Reported-by: Tomas Vondra
Discussion: https://postgr.es/m/05ebcb44-f383-86e3-4f31-0a97a55634cf@enterprisedb.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/indexam.sgml | 11 --
src/backend/access/brin/brin.c | 1 -
src/backend/access/gin/ginutil.c | 1 -
src/backend/access/gist/gist.c | 1 -
src/backend/access/hash/hash.c | 1 -
src/backend/access/heap/heapam.c | 2 +-
src/backend/access/nbtree/nbtree.c | 1 -
src/backend/access/spgist/spgutils.c | 1 -
src/backend/utils/cache/relcache.c | 53 +++--
src/include/access/amapi.h | 2 -
src/include/utils/rel.h | 3 +-
src/include/utils/relcache.h | 4 +-
src/test/modules/dummy_index_am/dummy_index_am.c | 1 -
src/test/regress/expected/brin.out | 58 ------
src/test/regress/expected/stats.out | 242 -----------------------
src/test/regress/sql/brin.sql | 36 ----
src/test/regress/sql/stats.sql | 111 -----------
17 files changed, 27 insertions(+), 502 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-06-17 00:06:41 pgsql: doc: Do s/int/integer/ to describe the type of some GUC paramete
Previous Message Michael Paquier 2022-06-16 08:28:57 pgsql: Fix comment in regression tests for large objects