Skip to content

Comparison with pg_stat_statements

The pg_stat_monitor extension is developed on the basis of pg_stat_statements as its more advanced replacement.

Thus, pg_stat_monitor inherits the columns available in pg_stat_statements plus provides additional ones.

Note that 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 that the column names differ depending on the PostgreSQL version you are running.

PGSM PGSS PostgreSQL ≥ 17 PostgreSQL 15 - 16 PostgreSQL 13 - 14 PostgreSQL 11 - 12
✅ ❌ bucket bucket bucket bucket
✅ ❌ bucket_start_time bucket_start_time bucket_start_time bucket_start_time
✅ ✅ userid userid userid userid
✅ ❌ user user username username
✅ ✅ dbid dbid dbid dbid
✅ ❌ datname datname datname datname
✅ ❌ client_ip client_ip client_ip client_ip
✅ ❌ pgsm_query_id pgsm_query_id pgsm_query_id pgsm_query_id
✅ ✅ queryid queryid queryid queryid
✅ ✅ toplevel toplevel toplevel
✅ ❌ top_queryid top_queryid top_queryid top_queryid
✅ ❌ top_query top_query top_query top_query
✅ ✅ query query query query
✅ ❌ planid planid planid planid
✅ ❌ comments comments comments comments
✅ ❌ query_plan query_plan query_plan query_plan
✅ ❌ application_name application_name application_name application_name
✅ ❌ relations relations relations relations
✅ ❌ cmd_type cmd_type cmd_type cmd_type
✅ ❌ cmd_type_text cmd_type_text cmd_type_text cmd_type_text
✅ ❌ elevel elevel elevel elevel
✅ ❌ sqlcode sqlcode sqlcode sqlcode
✅ ❌ message message message message
✅ ✅ calls calls calls calls
✅ ✅ total_exec_time total_exec_time total_exec_time total_time
✅ ✅ min_exec_time min_exec_time min_exec_time min_time
✅ ✅ max_exec_time max_exec_time max_exec_time max_time
✅ ✅ mean_exec_time mean_exec_time mean_exec_time mean_time
✅ ✅ stddev_exec_time stddev_exec_time stddev_exec_time stddev_time
✅ ✅ rows rows rows rows
✅ ✅ plans plans plans
✅ ✅ 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_dirtied shared_blks_dirtied shared_blks_dirtied shared_blks_dirtied
✅ ✅ 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_read local_blks_read local_blks_read local_blks_read
✅ ✅ local_blks_dirtied local_blks_dirtied local_blks_dirtied local_blks_dirtied
✅ ✅ 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_written temp_blks_written temp_blks_written temp_blks_written
✅ ✅ shared_blk_read_time blk_read_time blk_read_time blk_read_time
✅ ✅ shared_blk_write_time blk_write_time blk_write_time blk_write_time
✅ ✅ local_blk_read_time
✅ ✅ local_blk_write_time
✅ ❌ resp_calls resp_calls resp_calls resp_calls
✅ ✅ cpu_user_time cpu_user_time cpu_user_time cpu_user_time
✅ ✅ cpu_sys_time cpu_sys_time cpu_sys_time cpu_sys_time
✅ ❌ bucket_done bucket_done bucket_done bucket_done
✅ ✅ wal_records wal_records wal_records
✅ ✅ wal_fpi wal_fpi wal_fpi
✅ ✅ wal_bytes wal_bytes wal_bytes
✅ ✅ total_plan_time total_plan_time total_plan_time
✅ ✅ min_plan_time min_plan_time min_plan_time
✅ ✅ max_plan_time max_plan_time max_plan_time
✅ ✅ mean_plan_time mean_plan_time mean_plan_time
✅ ✅ stddev_plan_time stddev_plan_time stddev_plan_time
✅ ✅ temp_blk_read_time temp_blk_read_time
✅ ✅ temp_blk_write_time temp_blk_write_time
✅ ✅ jit_functions jit_functions
✅ ✅ jit_generation_time jit_generation_time
✅ ✅ jit_inlining_count jit_inlining_count
✅ ✅ jit_inlining_time jit_inlining_time
✅ ✅ jit_optimization_count jit_optimization_count
✅ ✅ jit_optimization_time jit_optimization_time
✅ ✅ jit_emission_count jit_emission_count
✅ ✅ jit_emission_time jit_emission_time
✅ ✅ jit_deform_count
✅ ✅ jit_deform_time
✅ ✅ stats_since
✅ ✅ minmax_stats_since

To learn more about the features in pg_stat_monitor, please see the User guide.

Additional reading: pg_stat_statements

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services.


  1. Available starting from PostgreSQL 14 and above