http://developer.postgresql.org/pgdocs/postgres/monitoring-stats.html says: "Note: blocks_fetched minus blocks_hit gives the number of kernel read() calls issued for the table, index, or database; but the actual number of physical reads is usually lower due to kernel-level buffering." This seems to imply that anything that increases blocks_hit should also increase blocks_fetched, but that doesn't seem to match the actual behavior.
rhaas=# select heap_blks_read, heap_blks_hit from pg_statio_user_tables; heap_blks_read | heap_blks_hit ----------------+--------------- 4356 | 5618 (1 row) rhaas=# select sum(1) from foo; sum -------- 100000 (1 row) rhaas=# select heap_blks_read, heap_blks_hit from pg_statio_user_tables; heap_blks_read | heap_blks_hit ----------------+--------------- 4356 | 6354 (1 row) Obviously, if the note above were correct then (1) the number of read() calls issue by the kernel would be negative and (2) accessing the relation when it is fully cached would decreases the number of read() calls previously issued. ...Robert -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers