pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Pass down "logically unchanged index" hint.
Date: Wed, 13 Jan 2021 16:11:20 +0000
Message-ID: <E1kzijw-0007MT-Os@gemulon.postgresql.org> (raw)

Pass down "logically unchanged index" hint.

Add an executor aminsert() hint mechanism that informs index AMs that
the incoming index tuple (the tuple that accompanies the hint) is not
being inserted by execution of an SQL statement that logically modifies
any of the index's key columns.

The hint is received by indexes when an UPDATE takes place that does not
apply an optimization like heapam's HOT (though only for indexes where
all key columns are logically unchanged).  Any index tuple that receives
the hint on insert is expected to be a duplicate of at least one
existing older version that is needed for the same logical row.  Related
versions will typically be stored on the same index page, at least
within index AMs that apply the hint.

Recognizing the difference between MVCC version churn duplicates and
true logical row duplicates at the index AM level can help with cleanup
of garbage index tuples.  Cleanup can intelligently target tuples that
are likely to be garbage, without wasting too many cycles on less
promising tuples/pages (index pages with little or no version churn).

This is infrastructure for an upcoming commit that will teach nbtree to
perform bottom-up index deletion.  No index AM actually applies the hint
just yet.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wz=CEKFa74EScx_hFVshCOn6AA5T-ajFASTdzipdkLTNQQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9dc718bdf2b1a574481a45624d42b674332e2903

Modified Files
--------------
contrib/bloom/blinsert.c                         |   1 +
contrib/bloom/bloom.h                            |   1 +
doc/src/sgml/indexam.sgml                        |  15 +++
src/backend/access/brin/brin.c                   |   1 +
src/backend/access/common/toast_internals.c      |   2 +-
src/backend/access/gin/gininsert.c               |   1 +
src/backend/access/gist/gist.c                   |   1 +
src/backend/access/hash/hash.c                   |   1 +
src/backend/access/heap/heapam_handler.c         |   1 +
src/backend/access/index/indexam.c               |   4 +-
src/backend/access/nbtree/nbtree.c               |   1 +
src/backend/access/spgist/spginsert.c            |   1 +
src/backend/catalog/indexing.c                   |   1 +
src/backend/commands/constraint.c                |   2 +-
src/backend/commands/copyfrom.c                  |   5 +-
src/backend/commands/trigger.c                   |   6 +-
src/backend/executor/execIndexing.c              | 160 ++++++++++++++++++++++-
src/backend/executor/execMain.c                  |   8 +-
src/backend/executor/execReplication.c           |   8 +-
src/backend/executor/nodeModifyTable.c           |   6 +-
src/backend/replication/logical/worker.c         |   3 +-
src/include/access/amapi.h                       |   1 +
src/include/access/brin_internal.h               |   1 +
src/include/access/genam.h                       |   1 +
src/include/access/gin_private.h                 |   1 +
src/include/access/gist_private.h                |   1 +
src/include/access/hash.h                        |   1 +
src/include/access/nbtree.h                      |   1 +
src/include/access/spgist.h                      |   1 +
src/include/executor/executor.h                  |   1 +
src/test/modules/dummy_index_am/dummy_index_am.c |   1 +
31 files changed, 214 insertions(+), 25 deletions(-)



Message-ID: <E1kzijw-0007MT-Os@gemulon.postgresql.org>
Permalink:  ../E1kzijw-0007MT-Os@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kzijw-0007MT-Os@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: pg@bowt.ie
  Subject: Re: pgsql: Pass down "logically unchanged index" hint.
  In-Reply-To: <E1kzijw-0007MT-Os@gemulon.postgresql.org>
  References: <E1kzijw-0007MT-Os@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox