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

Commitd67dae0

Browse files
committed
Don't count zero-filled buffers as 'read' in EXPLAIN.
If you extend a relation, it should count as a block written, notread (we write a zero-filled block). If you ask for a zero-filledbuffer, it shouldn't be counted as read or written.Later we might consider counting zero-filled buffers with a separatecounter, if they become more common due to future work.Author: Thomas MunroReviewed-by: Haribabu Kommi, Kyotaro Horiguchi, David RowleyDiscussion:https://postgr.es/m/CAEepm%3D3JytB3KPpvSwXzkY%2Bdwc5zC8P8Lk7Nedkoci81_0E9rA%40mail.gmail.com
1 parent471a7af commitd67dae0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,10 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
733733
bufHdr=LocalBufferAlloc(smgr,forkNum,blockNum,&found);
734734
if (found)
735735
pgBufferUsage.local_blks_hit++;
736-
else
736+
elseif (isExtend)
737+
pgBufferUsage.local_blks_written++;
738+
elseif (mode==RBM_NORMAL||mode==RBM_NORMAL_NO_LOG||
739+
mode==RBM_ZERO_ON_ERROR)
737740
pgBufferUsage.local_blks_read++;
738741
}
739742
else
@@ -746,7 +749,10 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
746749
strategy,&found);
747750
if (found)
748751
pgBufferUsage.shared_blks_hit++;
749-
else
752+
elseif (isExtend)
753+
pgBufferUsage.shared_blks_written++;
754+
elseif (mode==RBM_NORMAL||mode==RBM_NORMAL_NO_LOG||
755+
mode==RBM_ZERO_ON_ERROR)
750756
pgBufferUsage.shared_blks_read++;
751757
}
752758

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp