pgsql: Pass down "logically unchanged index" hint.

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема pgsql: Pass down "logically unchanged index" hint.
Дата
Msg-id E1kzijw-0007MT-Os@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: pgsql: Log long wait time on recovery conflict when it's resolved.
Следующее
От: Peter Geoghegan
Дата:
Сообщение: pgsql: Enhance nbtree index tuple deletion.