4.8 KiB
4.8 KiB
Comparing pg_stat_monitor and 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.
To see all available columns, run the following command from the psql
terminal:
postgres=# \d pg_stat_monitor;
The following table compares the pg_stat_monitor
view with that of pg_stat_statements
.
Note that the column names differ depending on the PostgreSQL version you are running.
Column name for PostgreSQL 13 and above | Column name for PostgreSQL 11 and 12 | pg_stat_monitor | pg_stat_statements |
---|---|---|---|
bucket | bucket | ✔️ | ❌ |
bucket_start_time | bucket_start_time | ✔️ | ❌ |
userid | userid | ✔️ | ✔️ |
datname | datname | ✔️ | ✔️ |
toplevel1 | ✔️ | ✔️ | |
client_ip | client_ip | ✔️ | ❌ |
queryid | queryid | ✔️ | ✔️ |
planid | planid | ✔️ | ❌ |
query_plan | query_plan | ✔️ | ❌ |
top_query | top_query | ✔️ | ❌ |
top_queryid | top_queryid | ✔️ | ❌ |
query | query | ✔️ | ✔️ |
application_name | application_name | ✔️ | ❌ |
relations | relations | ✔️ | ❌ |
cmd_type | cmd_type | ✔️ | ❌ |
elevel | elevel | ✔️ | ❌ |
sqlcode | sqlcode | ✔️ | ❌ |
message | message | ✔️ | ❌ |
plans_calls | plans_calls | ✔️ | ✔️ |
total_plan_time | ✔️ | ✔️ | |
min_plan_time | ✔️ | ✔️ | |
max_plan_time | ✔️ | ✔️ | |
mean_plan_time | ✔️ | ✔️ | |
stddev_plan_time | ✔️ | ✔️ | |
calls | calls | ✔️ | ✔️ |
total_exec_time | total_time | ✔️ | ✔️ |
min_exec_time | min_time | ✔️ | ✔️ |
max_exec_time | max_time | ✔️ | ✔️ |
mean_exec_time | mean_time | ✔️ | ✔️ |
stddev_exec_time | stddev_time | ✔️ | ✔️ |
rows_retrieved | rows_retrieved | ✔️ | ✔️ |
shared_blks_hit | shared_blks_hit | ✔️ | ✔️ |
shared_blks_read | shared_blks_read | ✔️ | ✔️ |
shared_blks_dirtied | shared_blks_dirtied | ✔️ | ✔️ |
shared_blks_written | shared_blks_written | ✔️ | ✔️ |
local_blks_hit | local_blks_hit | ✔️ | ✔️ |
local_blks_read | local_blks_read | ✔️ | ✔️ |
local_blks_dirtied | local_blks_dirtied | ✔️ | ✔️ |
local_blks_written | local_blks_written | ✔️ | ✔️ |
temp_blks_read | temp_blks_read | ✔️ | ✔️ |
temp_blks_written | temp_blks_written | ✔️ | ✔️ |
blk_read_time | blk_read_time | ✔️ | ✔️ |
blk_write_time | blk_write_time | ✔️ | ✔️ |
resp_calls | resp_calls | ✔️ | ❌ |
cpu_user_time | cpu_user_time | ✔️ | ❌ |
cpu_sys_time | cpu_sys_time | ✔️ | ❌ |
wal_records | wal_records | ✔️ | ✔️ |
wal_fpi | wal_fpi | ✔️ | ✔️ |
wal_bytes | wal_bytes | ✔️ | ✔️ |
state_code | state_code | ✔️ | ❌ |
state | state | ✔️ | ❌ |
To learn more about the features in pg_stat_monitor
, please see the User guide.
Additional reading: pg_stat_statements
-
Available starting from PostgreSQL 14 and above ↩︎