| From: | Greg Burd <greg(at)burd(dot)me> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Cc: | Peter Geoghegan <pg(at)bowt(dot)ie>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Subject: | Re: Tepid: selective index updates for heap relations |
| Date: | 2026-11-20 12:36:10 |
| Message-ID: | awA-bM_hQdeJx3bc@floki |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Here is v84, rebased on 45047c51aab. It fixes one more problem in
the unique-index path; the rest are small cleanups.
While checking a unique index, _bt_check_unique() rechecks a flagged
entry by comparing its stored key with the live row's key, and it does
that while holding the leaf page lock. If the row kept that key column
out of line, the comparison fetched it from the TOAST table under the
lock: a TOAST index scan and possibly I/O on two more relations, which
core never does while holding a btree page lock. Results were correct;
the locking was not. I reproduced it with a 2400-byte unique text key
stored EXTERNAL and confirmed the fetch in gdb under bttextcmp().
v84 makes the rule part of the fetch_tid_check() contract: when it asks
for a recheck, the slot's unique key columns must not be stored out of
line. Heap meets that by falling back to a regular update when a
HOT-indexed update would store a unique key column out of line, and
nbtree asserts it. Only unique indexes are affected, so a large column
with a GIN index, say, still gets HOT-indexed updates. The new test in
0018 trips the assertion without the heap change.
The cleanups:
- 0013: ri_FastPathProbeOne() is back to master's code, since the AM
now skips flagged entries itself. RelationGetIndexedAttrs() no
longer leaks its parsed expression trees. nbtinsert.c drops an
unused include.
- 0016: removed the prefix_all_dead out-parameter of
heap_hot_search_buffer(), whose only output nothing read.
- 0006: AfterTriggerSaveImage() errors out instead of wrapping its
image count.
- 0012, 0013, 0018, 0019: comment fixes, a skip guard in
001_concurrent_hot.pl, and a redundant check removed from 039.
The other patches differ from v83 only by the rebase.
-greg
| Attachment | Content-Type | Size |
|---|---|---|
| tepid-v84.tgz | application/gzip | 274.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-11-20 12:40:28 | Re: [PATCH] pg_upgrade: add --initdb option to create the new cluster automatically |
| Previous Message | Vaibhav Dalvi | 2026-11-20 12:27:36 | Re: walreceiver: stale hot_standby_feedback xmin on primary when wal_receiver_status_interval = 0 (PG16 and later) |