log_statement_stats
A configuration parameter determining whether to log statement performance statistics
log_statement_stats
is a configuration parameter determining whether to log detailed performance statistics for statement execution.
log_statement_stats
was added in PostgreSQL 7.4.
Usage
If log_statement_stats
is set to "on", a DETAIL
line will be emitted containing details about the statement execution, including execution time and memory / i/o usage.
log_statement_stats
cannot be enabled at the same time as one or more of log_executor_stats
, log_parser_stats
, or log_planner_stats
.
Default value
The default value for log_statement_stats
is: off
.
Change history
- PostgreSQL 11
- memory usage displayed in output (commit c039ba07)
- PostgreSQL 7.4
- added (commit d36aa2e8)
Examples
Log output from issuing a simple statement ("SELECT 1
"):
[2021-03-29 17:23:14 UTC] psql postgres postgres STATEMENT: SELECT 1; [2021-03-29 17:23:14 UTC] psql postgres postgres LOG: 00000: QUERY STATISTICS [2021-03-29 17:23:14 UTC] psql postgres postgres DETAIL: ! system usage stats: ! 0.000330 s user, 0.000000 s system, 0.000333 s elapsed ! [0.002029 s user, 0.000000 s system total] ! 10956 kB max resident size ! 0/0 [0/0] filesystem blocks in/out ! 0/22 [0/461] page faults/reclaims, 0 [0] swaps ! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent ! 0/0 [3/0] voluntary/involuntary context switches
It is not possible to enable log_executor_stats
, log_parser_stats
, or log_planner_stats
:
[2021-03-29 17:46:23 UTC] LOG: 22023: invalid value for parameter "log_executor_stats": 1 [2021-03-29 17:46:23 UTC] DETAIL: Cannot enable parameter when "log_statement_stats" is true.
References
- PostgreSQL documentation: Statistics Monitoring