aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2021-01-13 08:11:00 -0800
committerPeter Geoghegan <pg@bowt.ie>2021-01-13 08:11:00 -0800
commit9dc718bdf2b1a574481a45624d42b674332e2903 (patch)
treed3ead00924eb54e9167c701a90cd90f285f2132e /doc/src
parent39b03690b529935a3c33024ee68f08e2d347cf4f (diff)
downloadpostgresql-9dc718bdf2b1a574481a45624d42b674332e2903.tar.gz
postgresql-9dc718bdf2b1a574481a45624d42b674332e2903.zip
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
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/indexam.sgml15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml
index f00268d5b51..ec5741df6d1 100644
--- a/doc/src/sgml/indexam.sgml
+++ b/doc/src/sgml/indexam.sgml
@@ -293,6 +293,7 @@ aminsert (Relation indexRelation,
ItemPointer heap_tid,
Relation heapRelation,
IndexUniqueCheck checkUnique,
+ bool indexUnchanged,
IndexInfo *indexInfo);
</programlisting>
Insert a new tuple into an existing index. The <literal>values</literal> and
@@ -309,6 +310,20 @@ aminsert (Relation indexRelation,
</para>
<para>
+ The <literal>indexUnchanged</literal> boolean value gives a hint
+ about the nature of the tuple to be indexed. When it is true,
+ the tuple is a duplicate of some existing tuple in the index. The
+ new tuple is a logically unchanged successor MVCC tuple version. This
+ happens when an <command>UPDATE</command> takes place that does not
+ modify any columns covered by the index, but nevertheless requires a
+ new version in the index. The index AM may use this hint to decide
+ to apply bottom-up index deletion in parts of the index where many
+ versions of the same logical row accumulate. Note that updating a
+ non-key column does not affect the value of
+ <literal>indexUnchanged</literal>.
+ </para>
+
+ <para>
The function's Boolean result value is significant only when
<literal>checkUnique</literal> is <literal>UNIQUE_CHECK_PARTIAL</literal>.
In this case a true result means the new entry is known unique, whereas