Re: Expanding HOT updates for expression and partial indexes - Mailing list pgsql-hackers

From Greg Burd
Subject Re: Expanding HOT updates for expression and partial indexes
Date
Msg-id 872b875c-0aa4-4269-9c84-532227b32361@app.fastmail.com
Whole thread Raw
In response to Re: Expanding HOT updates for expression and partial indexes  ("Greg Burd" <greg@burd.me>)
Responses Re: Expanding HOT updates for expression and partial indexes
List pgsql-hackers
Hello again,

Attached is v35 (master@f4a4ce52c0d) where I've separated out changes into three patches.  Still nothing related to
$subjectdirectly, but foundational for that work (coming soon).  I'd like to get these into v19 if at all possible and
thentarget the rest of $subject for v20 so that it has more time to soak.
 

0001 - This patch adds tests to validate and capture the expected behavior of Heap-only tuple (HOT) updates.  This also
servesas a foundation that will aide in documenting what exactly changed in the commits implementing $subject at some
laterdate.  This patch isn't required, but it does a good job of demonstrating that a) the changes in 0002 don't impact
HOTdecisions (as intended) and b) that future patches which change HOT behavior have a very obvious record of what
changedbecause they update these test results (not tests) to illustrate that.  That said, if the next two patches are
mergedwithout this one I'd be just as happy as if all 3 made it into v19.
 

0002 - This patch plugs a hole (bug?) in ExecGetAllUpdatedCols() which is triggered by an existing test in tsearch.sql
andthe tsvector_update_trigger().  That trigger uses heap_modify_tuple() to change an indexed attribute that is not
discoveredby ExecGetAllUpdatedCols(), which seems odd to me at best and at worst wrong (or even a potential security
issue). This patch finds and adds columns that are updated into the Bitmapset returned by ExecGetAllUpdatedCols().  The
patchincludes a helper function ExecCompareSlotAttrs() that will be used in follow-on patches as well.
 

0003 - This patch moves the logic for HeapDetermineColumnsInfo() into the executor while preserving the functionality
ofsimple_heap_update().  A few helper functions are created to better illustrate HOT and lock mode decision making and
arereused when possible.  The portion of HeapDetermineColumnsInfo() related to replica identity key WAL logging is now
in-linein heap_update().
 

These commits maintain 100% identical logic for HOT, lockmode, and replica identity decisions (or there's a flaw and
thatshould be fixed so let me know)  They simply juggle the logic into places where I think they fit better and provide
forfuture work in this area.
 

I appreciate your time and effort considering these changes.

best.

-greg

Attachment

pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Defend against -ffast-math in meson builds
Next
From: Andres Freund
Date:
Subject: Re: Fix typo 586/686 in atomics/arch-x86.h