I want to know how to verify disk hits by a select
query in PostgreSQL 9.4 on CentOS 6.5. Also please let me know how far enabling the log_statement_stats
in the postgresql.conf
will help me.
I need to understand the 'filesystem blocks in/out' value in the logs when I switch the above parameter to on
.
For example, please check the log snippet:
2016-02-03 14:12:45 PST LOG: statement: select * from test_stats_collect ;
2016-02-03 14:12:45 PST LOG: QUERY STATISTICS
2016-02-03 14:12:45 PST DETAIL: ! system usage stats:
! 0.069489 elapsed 0.027995 user 0.002999 system sec
! [0.131979 user 0.146977 sys total]
! 0/0 [3280/26440] filesystem blocks in/out
! 0/5 [19/4866] page faults/reclaims, 0 [0] swaps
! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent
! 20/116 [125/174] voluntary/involuntary context switches
Best Answer
The numbers reported by log_statement_stats come directly from the
getrusage
system call (assuming your OS has one). The numbers in square brackets are total for the session so far, the other numbers are deltas between the start and stop of the statement.The filesystem block size is not normalized to be the same as the PostgresSQL block size. It is in whatever units of block size your OS reports in
getrusage
.