获取执行总时间最长的语句
最近更新时间: 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 desc
limit 10;