Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1a6f5a0

Browse files
Go back to considering HOT on pages marked full.
Commit2fd8685 simplified the checking of modified attributes thattakes place within heap_update(). This included a micro-optimizationaffecting pages marked PD_PAGE_FULL: don't even try to use HOT to save afew cycles on determining HOT safety. The assumption was that it won'twork out this time around, since it can't have worked out last timearound.Remove the micro-optimization. It could only ever save cycles that areconsumed by the vast majority of heap_update() calls, which hardly seemsworth the added complexity. It also seems quite possible that there areworkloads that will do worse over time by repeated application of themicro-optimization, despite saving some cycles on average, in the shortterm.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Álvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://postgr.es/m/CAH2-WznU1L3+DMPr1F7o2eJBT7=3bAJoY6ZkWABAxNt+-afyTA@mail.gmail.com
1 parentdd484c9 commit1a6f5a0

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,7 +3179,6 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
31793179
boolhave_tuple_lock= false;
31803180
booliscombo;
31813181
booluse_hot_update= false;
3182-
boolhot_attrs_checked= false;
31833182
boolkey_intact;
31843183
boolall_visible_cleared= false;
31853184
boolall_visible_cleared_new= false;
@@ -3228,32 +3227,15 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
32283227
key_attrs=RelationGetIndexAttrBitmap(relation,INDEX_ATTR_BITMAP_KEY);
32293228
id_attrs=RelationGetIndexAttrBitmap(relation,
32303229
INDEX_ATTR_BITMAP_IDENTITY_KEY);
3231-
3230+
interesting_attrs=NULL;
3231+
interesting_attrs=bms_add_members(interesting_attrs,hot_attrs);
3232+
interesting_attrs=bms_add_members(interesting_attrs,key_attrs);
3233+
interesting_attrs=bms_add_members(interesting_attrs,id_attrs);
32323234

32333235
block=ItemPointerGetBlockNumber(otid);
32343236
buffer=ReadBuffer(relation,block);
32353237
page=BufferGetPage(buffer);
32363238

3237-
interesting_attrs=NULL;
3238-
3239-
/*
3240-
* If the page is already full, there is hardly any chance of doing a HOT
3241-
* update on this page. It might be wasteful effort to look for index
3242-
* column updates only to later reject HOT updates for lack of space in
3243-
* the same page. So we be conservative and only fetch hot_attrs if the
3244-
* page is not already full. Since we are already holding a pin on the
3245-
* buffer, there is no chance that the buffer can get cleaned up
3246-
* concurrently and even if that was possible, in the worst case we lose a
3247-
* chance to do a HOT update.
3248-
*/
3249-
if (!PageIsFull(page))
3250-
{
3251-
interesting_attrs=bms_add_members(interesting_attrs,hot_attrs);
3252-
hot_attrs_checked= true;
3253-
}
3254-
interesting_attrs=bms_add_members(interesting_attrs,key_attrs);
3255-
interesting_attrs=bms_add_members(interesting_attrs,id_attrs);
3256-
32573239
/*
32583240
* Before locking the buffer, pin the visibility map page if it appears to
32593241
* be necessary. Since we haven't got the lock yet, someone else might be
@@ -3867,10 +3849,9 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
38673849
/*
38683850
* Since the new tuple is going into the same page, we might be able
38693851
* to do a HOT update. Check if any of the index columns have been
3870-
* changed. If the page was already full, we may have skipped checking
3871-
* for index columns, and also can't do a HOT update.
3852+
* changed.
38723853
*/
3873-
if (hot_attrs_checked&&!bms_overlap(modified_attrs,hot_attrs))
3854+
if (!bms_overlap(modified_attrs,hot_attrs))
38743855
use_hot_update= true;
38753856
}
38763857
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp