diff options
author | Andres Freund | 2023-03-31 02:22:40 +0000 |
---|---|---|
committer | Andres Freund | 2023-03-31 02:24:21 +0000 |
commit | 8aaa04b32d790da595684de58ae4fc2db96becff (patch) | |
tree | d9993491ee35f81fbf8be407a4ef76b486768ef0 /src/include | |
parent | 6c3b697b19db6274da622cf0fe7a7ad32eeeced3 (diff) |
Track shared buffer hits in pg_stat_io
Among other things, this should make it easier to calculate a useful cache hit
ratio by excluding buffer reads via buffer access strategies. As buffer access
strategies reuse buffers (and thus evict the prior buffer contents), it is
normal to see reads on repeated scans of the same data.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAAKRu_beMa9Hzih40%3DXPYqhDVz6tsgUGTrhZXRo%3Dunp%2Bszb%3DUA%40mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/pg_proc.dat | 6 | ||||
-rw-r--r-- | src/include/pgstat.h | 1 | ||||
-rw-r--r-- | src/include/storage/buf_internals.h | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index 5736c1082cf..f9f26422015 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -5749,9 +5749,9 @@ proname => 'pg_stat_get_io', provolatile => 'v', prorows => '30', proretset => 't', proparallel => 'r', prorettype => 'record', proargtypes => '', - proallargtypes => '{text,text,text,int8,int8,int8,int8,int8,int8,int8,timestamptz}', - proargmodes => '{o,o,o,o,o,o,o,o,o,o,o}', - proargnames => '{backend_type,io_object,io_context,reads,writes,extends,op_bytes,evictions,reuses,fsyncs,stats_reset}', + proallargtypes => '{text,text,text,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz}', + proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o}', + proargnames => '{backend_type,io_object,io_context,reads,writes,extends,op_bytes,hits,evictions,reuses,fsyncs,stats_reset}', prosrc => 'pg_stat_get_io' }, { oid => '1136', descr => 'statistics: information about WAL activity', diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 17ee94d8b66..a56182af9fa 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -296,6 +296,7 @@ typedef enum IOOp IOOP_EVICT, IOOP_EXTEND, IOOP_FSYNC, + IOOP_HIT, IOOP_READ, IOOP_REUSE, IOOP_WRITE, diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index 0b448147407..2afb9bb3099 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -419,7 +419,7 @@ extern PrefetchBufferResult PrefetchLocalBuffer(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum); extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, - BlockNumber blockNum, bool *foundPtr, IOContext *io_context); + BlockNumber blockNum, bool *foundPtr); extern void MarkLocalBufferDirty(Buffer buffer); extern void DropRelationLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum, |