mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
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 as5753d4ee32
, but then got reverted bye3fcca0d0d
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
This commit is contained in:
@ -110,8 +110,8 @@ typedef struct ModifyTableContext
|
||||
typedef struct UpdateContext
|
||||
{
|
||||
bool updated; /* did UPDATE actually occur? */
|
||||
bool updateIndexes; /* index update required? */
|
||||
bool crossPartUpdate; /* was it a cross-partition update? */
|
||||
TU_UpdateIndexes updateIndexes; /* Which index updates are required? */
|
||||
|
||||
/*
|
||||
* Lock mode to acquire on the latest tuple version before performing
|
||||
@ -1099,7 +1099,8 @@ ExecInsert(ModifyTableContext *context,
|
||||
recheckIndexes = ExecInsertIndexTuples(resultRelInfo,
|
||||
slot, estate, false, true,
|
||||
&specConflict,
|
||||
arbiterIndexes);
|
||||
arbiterIndexes,
|
||||
false);
|
||||
|
||||
/* adjust the tuple's state accordingly */
|
||||
table_tuple_complete_speculative(resultRelationDesc, slot,
|
||||
@ -1138,7 +1139,8 @@ ExecInsert(ModifyTableContext *context,
|
||||
if (resultRelInfo->ri_NumIndices > 0)
|
||||
recheckIndexes = ExecInsertIndexTuples(resultRelInfo,
|
||||
slot, estate, false,
|
||||
false, NULL, NIL);
|
||||
false, NULL, NIL,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2118,11 +2120,12 @@ ExecUpdateEpilogue(ModifyTableContext *context, UpdateContext *updateCxt,
|
||||
List *recheckIndexes = NIL;
|
||||
|
||||
/* insert index entries for tuple if necessary */
|
||||
if (resultRelInfo->ri_NumIndices > 0 && updateCxt->updateIndexes)
|
||||
if (resultRelInfo->ri_NumIndices > 0 && (updateCxt->updateIndexes != TU_None))
|
||||
recheckIndexes = ExecInsertIndexTuples(resultRelInfo,
|
||||
slot, context->estate,
|
||||
true, false,
|
||||
NULL, NIL);
|
||||
NULL, NIL,
|
||||
(updateCxt->updateIndexes == TU_Summarizing));
|
||||
|
||||
/* AFTER ROW UPDATE Triggers */
|
||||
ExecARUpdateTriggers(context->estate, resultRelInfo,
|
||||
|
Reference in New Issue
Block a user