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

Commitd4b5d4c

Browse files
committed
pgstattuple: Don't take heavyweight locks when examining a hash index.
It's currently necessary to take a heavyweight lock when scanning ahash bucket, but pgstattuple only examines individual pages, so itdoesn't need to do this. If, for some hypothetical reason, it didneed to do any heavyweight locking here, this logic would probablystill be incorrect, because most of the locks that it is taking aremeaningless. Only a heavyweight lock on a primary bucket page has anymeaning, but this takes heavyweight locks on all pages regardless offunction - and in particular overflow pages, where you might imaginethat we'd want to lock the primary bucket page if we needed to lockanything at all.This is arguably a bug that has existed since this code was added incommitdab4238, but I'm not going tobother back-patching it because in most cases the only consequence isthat running pgstattuple() on a hash index is a little slower than itotherwise might be, which is no big deal.Extracted from a vastly larger patch by Amit Kapila which heavyweightlocking for hash indexes entirely; analysis of why this can be doneindependently of the rest by me.
1 parent33839b5 commitd4b5d4c

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

‎contrib/pgstattuple/pgstattuple.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ pgstat_hash_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno,
441441
Bufferbuf;
442442
Pagepage;
443443

444-
_hash_getlock(rel,blkno,HASH_SHARE);
445444
buf=_hash_getbuf_with_strategy(rel,blkno,HASH_READ,0,bstrategy);
446445
page=BufferGetPage(buf);
447446

@@ -472,7 +471,6 @@ pgstat_hash_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno,
472471
}
473472

474473
_hash_relbuf(rel,buf);
475-
_hash_droplock(rel,blkno,HASH_SHARE);
476474
}
477475

478476
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp