-- pspg is highly recommended https://github.com/okbob/pspg

select
  row_number() over (order by total_time desc) num,
  round(total_time), calls, rows, mean_time, min_time, max_time, left(query, 500)
from pg_stat_statements
order by total_time desc
limit 50;

-- pre 9.5/9.6

select
  row_number() over (order by total_time desc) num,
  calls, total_time, total_time::numeric/calls avg_time, query
from pg_stat_statements
order by total_time desc
limit 50;