获取每句平均执行时间最长的语句
最近更新时间: 2024-10-17 17:10:00
postgres=# select
pg_authid.rolname as rolname,
pg_database.datname as datname,
pg_stat_statements.query,
pg_stat_statements.calls,
pg_stat_statements.total_time,
pg_stat_statements.total_time/pg_stat_statements.calls as onestime
from
pg_stat_statements
inner join pg_authid on pg_authid.oid=pg_stat_statements.userid
inner join pg_database on pg_database.oid= pg_stat_statements.dbid
order by
pg_stat_statements.total_time/pg_stat_statements.calls desc
limit 10;