This Postgres SQL checks how much each query in each database uses the CPU. It provides a resultset sorted in descending order by the most CPU-intensive queries. For PostgreSQL versions 12 and earlier: SELECT
pss.userid,
pss.dbid,
pd.datname as db_name,
round(pss.total_time::numeric, 2) as total_time,
pss.calls,
round(pss.mean_time::numeric, 2) as…