pgsql: Ignore BRIN indexes when checking for HOT updates

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Ignore BRIN indexes when checking for HOT updates
Date: 2023-03-20 10:07:02
Message-ID: E1peCPu-004SkQ-1A@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Ignore BRIN indexes when checking for HOT updates

When determining whether an index update may be skipped by using HOT, we
can ignore attributes indexed by block summarizing indexes without
references to individual tuples that need to be cleaned up.

A new type TU_UpdateIndexes provides a signal to the executor to
determine which indexes to update - no indexes, all indexes, or only the
summarizing indexes.

This also removes rd_indexattr list, and replaces it with rd_attrsvalid
flag. The list was not used anywhere, and a simple flag is sufficient.

This was originally committed as 5753d4ee32, but then got reverted by
e3fcca0d0d because of correctness issues.

Original patch by Josef Simanek, various fixes and improvements by Tomas
Vondra and me.

Authors: Matthias van de Meent, Josef Simanek, Tomas Vondra
Reviewed-by: Tomas Vondra, Alvaro Herrera
Discussion: https://postgr.es/m/05ebcb44-f383-86e3-4f31-0a97a55634cf@enterprisedb.com
Discussion: https://postgr.es/m/CAFp7QwpMRGcDAQumN7onN9HjrJ3u4X3ZRXdGFT0K5G2JWvnbWg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/19d8e2308bc51ec4ab993ce90077342c915dd116

Modified Files
--------------
doc/src/sgml/indexam.sgml | 13 +++
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 | 48 +++++++++-
src/backend/access/heap/heapam_handler.c | 19 +++-
src/backend/access/nbtree/nbtree.c | 1 +
src/backend/access/spgist/spgutils.c | 1 +
src/backend/access/table/tableam.c | 2 +-
src/backend/catalog/index.c | 9 +-
src/backend/catalog/indexing.c | 35 +++++--
src/backend/commands/copyfrom.c | 5 +-
src/backend/commands/indexcmds.c | 10 +-
src/backend/executor/execIndexing.c | 37 ++++++--
src/backend/executor/execReplication.c | 9 +-
src/backend/executor/nodeModifyTable.c | 13 ++-
src/backend/nodes/makefuncs.c | 7 +-
src/backend/utils/cache/relcache.c | 70 ++++++++++----
src/include/access/amapi.h | 2 +
src/include/access/heapam.h | 5 +-
src/include/access/tableam.h | 22 ++++-
src/include/executor/executor.h | 3 +-
src/include/nodes/execnodes.h | 2 +
src/include/nodes/makefuncs.h | 4 +-
src/include/utils/rel.h | 4 +-
src/include/utils/relcache.h | 5 +-
src/test/modules/dummy_index_am/dummy_index_am.c | 1 +
src/test/regress/expected/stats.out | 111 +++++++++++++++++++++++
src/test/regress/sql/stats.sql | 82 +++++++++++++++++
30 files changed, 448 insertions(+), 76 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2023-03-20 13:12:27 pgsql: doc/PDF: Add page breaks for <sect1> in contrib appendix
Previous Message Tomas Vondra 2023-03-20 09:29:05 pgsql: Fix netmask handling in inet_minmax_multi_ops