When you log pg's activity with statistics enabled you can get this
kind of report :
StartTransactionCommand
query: select * from identity where login='cat';
ProcessQuery
! system usage stats:
! 0.012632 elapsed 0.010000 user 0.000000 system sec
! [0.030000 user 0.010000 sys total]
! 0/0 [0/0] filesystem blocks in/out
! 49/55 [309/285] page faults/reclaims, 0 [0] swaps
! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent
! 0/0 [0/0] voluntary/involuntary context switches
! postgres usage stats:
! Shared blocks: 21 read, 0 written, buffer hit rate = 93.27%
! Local blocks: 0 read, 0 written, buffer hit rate = 0.00%
! Direct blocks: 0 read, 0 written
CommitTransactionCommand
The problem is when you have many queries every second, you get all
the lines mixed up : several queries can start before the first
gives the result. And so the stats are useless in production.
Would it be possible to have a unique identifier in the "query:" line
and another one at the beginning of the stats ? Maybe the backend's
PID ? The goal is to write some code to analyze the stats and :
- calculate global stats
- point out the bad queries (and produce the explain plan with the
report)
I posted nearly the same message a few days ago and was surprised not
seeing any answer. I wonder if the question is too stupid and if so
please, someone enlighten me ? Maybe it was meaningless, this
is why I tried to say things differently. My apologies for the ~repost
--
Jean-Christophe Boggio
cat@thefreecat.org
Independant Consultant and Developer
Delphi, Linux, Perl, PostgreSQL