Comparison with pg_stat_statements¶
The pg_stat_monitor extension is developed on the basis of pg_stat_statements as its more advanced replacement.
Because of this, pg_stat_monitor inherits the columns available in pg_stat_statements and provides additional ones.
Note
pg_stat_monitor and pg_stat_statements process statistics data differently. Because of these differences, memory blocks and WAL (Write Ahead Logs) related statistics data are displayed inconsistently when both extensions are used together.
To see all available columns, run the following command from the psql terminal:
\d pg_stat_monitor;
The following table compares the pg_stat_monitor (PGSM) view with that of pg_stat_statements (PGSS).
Note
The column names differ depending on the PostgreSQL version you are running.
Note
PostgreSQL 19 has not been released yet. pg_stat_monitor supports PostgreSQL 19 beta 3 so that you can test against it. See the 2.4.0 release notes.
Column Comparison Table¶
| PGSM | PGSS | PostgreSQL 19 beta 3 | PostgreSQL 18 | PostgreSQL 17 | PostgreSQL 15 - 16 | PostgreSQL 14 |
|---|---|---|---|---|---|---|
| bucket | bucket | bucket | bucket | bucket | ||
| bucket_start_time | bucket_start_time | bucket_start_time | bucket_start_time | bucket_start_time | ||
| userid | userid | userid | userid | userid | ||
| user | user | user | user | username | ||
| dbid | dbid | dbid | dbid | dbid | ||
| datname | datname | datname | datname | datname | ||
| client_ip | client_ip | client_ip | client_ip | client_ip | ||
| pgsm_query_id | pgsm_query_id | pgsm_query_id | pgsm_query_id | pgsm_query_id | ||
| queryid | queryid | queryid | queryid | queryid | ||
| toplevel | toplevel | toplevel | toplevel | toplevel | ||
| top_queryid | top_queryid | top_queryid | top_queryid | top_queryid | ||
| top_query | top_query | top_query | top_query | top_query | ||
| query | query | query | query | query | ||
| planid | planid | planid | planid | planid | ||
| comments | comments | comments | comments | comments | ||
| query_plan | query_plan | query_plan | query_plan | query_plan | ||
| application_name | application_name | application_name | application_name | application_name | ||
| relations | relations | relations | relations | relations | ||
| cmd_type | cmd_type | cmd_type | cmd_type | cmd_type | ||
| cmd_type_text | cmd_type_text | cmd_type_text | cmd_type_text | cmd_type_text | ||
| elevel | elevel | elevel | elevel | elevel | ||
| sqlcode | sqlcode | sqlcode | sqlcode | sqlcode | ||
| message | message | message | message | message | ||
| calls | calls | calls | calls | calls | ||
| total_exec_time | total_exec_time | total_exec_time | total_exec_time | total_exec_time | ||
| min_exec_time | min_exec_time | min_exec_time | min_exec_time | min_exec_time | ||
| max_exec_time | max_exec_time | max_exec_time | max_exec_time | max_exec_time | ||
| mean_exec_time | mean_exec_time | mean_exec_time | mean_exec_time | mean_exec_time | ||
| stddev_exec_time | stddev_exec_time | stddev_exec_time | stddev_exec_time | stddev_exec_time | ||
| rows | rows | rows | rows | rows | ||
| plans | plans | plans | plans | plans | ||
| shared_blks_hit | shared_blks_hit | shared_blks_hit | shared_blks_hit | shared_blks_hit | ||
| shared_blks_read | shared_blks_read | shared_blks_read | shared_blks_read | shared_blks_read | ||
| shared_blks_dirtied | shared_blks_dirtied | shared_blks_dirtied | shared_blks_dirtied | shared_blks_dirtied | ||
| shared_blks_written | shared_blks_written | shared_blks_written | shared_blks_written | shared_blks_written | ||
| local_blks_hit | local_blks_hit | local_blks_hit | local_blks_hit | local_blks_hit | ||
| local_blks_read | local_blks_read | local_blks_read | local_blks_read | local_blks_read | ||
| local_blks_dirtied | local_blks_dirtied | local_blks_dirtied | local_blks_dirtied | local_blks_dirtied | ||
| local_blks_written | local_blks_written | local_blks_written | local_blks_written | local_blks_written | ||
| temp_blks_read | temp_blks_read | temp_blks_read | temp_blks_read | temp_blks_read | ||
| temp_blks_written | temp_blks_written | temp_blks_written | temp_blks_written | temp_blks_written | ||
| shared_blk_read_time | shared_blk_read_time | shared_blk_read_time | blk_read_time | blk_read_time | ||
| shared_blk_write_time | shared_blk_write_time | shared_blk_write_time | blk_write_time | blk_write_time | ||
| local_blk_read_time | local_blk_read_time | local_blk_read_time | ||||
| local_blk_write_time | local_blk_write_time | local_blk_write_time | ||||
| resp_calls | resp_calls | resp_calls | resp_calls | resp_calls | ||
| cpu_user_time | cpu_user_time | cpu_user_time | cpu_user_time | cpu_user_time | ||
| cpu_sys_time | cpu_sys_time | cpu_sys_time | cpu_sys_time | cpu_sys_time | ||
| bucket_done | bucket_done | bucket_done | bucket_done | bucket_done | ||
| wal_records | wal_records | wal_records | wal_records | wal_records | ||
| wal_fpi | wal_fpi | wal_fpi | wal_fpi | wal_fpi | ||
| wal_bytes | wal_bytes | wal_bytes | wal_bytes | wal_bytes | ||
| wal_buffers_full | wal_buffers_full | |||||
| total_plan_time | total_plan_time | total_plan_time | total_plan_time | total_plan_time | ||
| min_plan_time | min_plan_time | min_plan_time | min_plan_time | min_plan_time | ||
| max_plan_time | max_plan_time | max_plan_time | max_plan_time | max_plan_time | ||
| mean_plan_time | mean_plan_time | mean_plan_time | mean_plan_time | mean_plan_time | ||
| stddev_plan_time | stddev_plan_time | stddev_plan_time | stddev_plan_time | stddev_plan_time | ||
| temp_blk_read_time | temp_blk_read_time | temp_blk_read_time | temp_blk_read_time | |||
| temp_blk_write_time | temp_blk_write_time | temp_blk_write_time | temp_blk_write_time | |||
| jit_functions | jit_functions | jit_functions | jit_functions | |||
| jit_generation_time | jit_generation_time | jit_generation_time | jit_generation_time | |||
| jit_inlining_count | jit_inlining_count | jit_inlining_count | jit_inlining_count | |||
| jit_inlining_time | jit_inlining_time | jit_inlining_time | jit_inlining_time | |||
| jit_optimization_count | jit_optimization_count | jit_optimization_count | jit_optimization_count | |||
| jit_optimization_time | jit_optimization_time | jit_optimization_time | jit_optimization_time | |||
| jit_emission_count | jit_emission_count | jit_emission_count | jit_emission_count | |||
| jit_emission_time | jit_emission_time | jit_emission_time | jit_emission_time | |||
| jit_deform_count | jit_deform_count | jit_deform_count | ||||
| jit_deform_time | jit_deform_time | jit_deform_time | ||||
| parallel_workers_to_launch | parallel_workers_to_launch | |||||
| parallel_workers_launched | parallel_workers_launched | |||||
| generic_plan_calls | ||||||
| custom_plan_calls | ||||||
| stats_since | stats_since | stats_since | ||||
| minmax_stats_since | minmax_stats_since | minmax_stats_since |
To learn more about the features in pg_stat_monitor, please see the User guide.
Read more about pg_stat_statements here .
Note
Available starting from PostgreSQL 14 and above.