CREATE EXTENSION IF NOT EXISTS pg_stat_statements; SELECT calls, total_exec_time, mean_exec_time, max_exec_time, rows, query FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 50;