| From: | "Greg Burd" <greg(at)burd(dot)me> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | "Jeff Davis" <pgsql(at)j-davis(dot)com>, "Nathan Bossart" <nathandbossart(at)gmail(dot)com> |
| Subject: | Re: Expanding HOT updates for expression and partial indexes |
| Date: | 2026-03-11 15:51:03 |
| Message-ID: | 872b875c-0aa4-4269-9c84-532227b32361@app.fastmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello again,
Attached is v35 (master(at)f4a4ce52c0d) where I've separated out changes into three patches. Still nothing related to $subject directly, but foundational for that work (coming soon). I'd like to get these into v19 if at all possible and then target 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 serves as a foundation that will aide in documenting what exactly changed in the commits implementing $subject at some later date. This patch isn't required, but it does a good job of demonstrating that a) the changes in 0002 don't impact HOT decisions (as intended) and b) that future patches which change HOT behavior have a very obvious record of what changed because they update these test results (not tests) to illustrate that. That said, if the next two patches are merged without 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 and the tsvector_update_trigger(). That trigger uses heap_modify_tuple() to change an indexed attribute that is not discovered by 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 patch includes 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 of simple_heap_update(). A few helper functions are created to better illustrate HOT and lock mode decision making and are reused when possible. The portion of HeapDetermineColumnsInfo() related to replica identity key WAL logging is now in-line in heap_update().
These commits maintain 100% identical logic for HOT, lockmode, and replica identity decisions (or there's a flaw and that should be fixed so let me know) They simply juggle the logic into places where I think they fit better and provide for future work in this area.
I appreciate your time and effort considering these changes.
best.
-greg
| Attachment | Content-Type | Size |
|---|---|---|
| v35-0001-Add-tests-to-cover-a-variety-of-heap-HOT-update-.patch | text/x-patch | 89.5 KB |
| v35-0002-Identify-and-track-columns-modified-by-heap_modi.patch | text/x-patch | 7.0 KB |
| v35-0003-Identify-modified-indexed-attributes-in-the-exec.patch | text/x-patch | 54.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2026-03-11 15:51:23 | Re: Fix typo 586/686 in atomics/arch-x86.h |
| Previous Message | Bertrand Drouvot | 2026-03-11 15:49:12 | Re: Defend against -ffast-math in meson builds |