Skip to content

Instantly share code, notes, and snippets.

@michelp
Created September 13, 2018 05:47
Show Gist options
  • Select an option

  • Save michelp/1f0d934f82101d2be408ec6fca7f9dcc to your computer and use it in GitHub Desktop.

Select an option

Save michelp/1f0d934f82101d2be408ec6fca7f9dcc to your computer and use it in GitHub Desktop.
select (regexp_matches(substring(query from 41), E'\"([a-z_]*)\"'))[1] as endpoint,
sum(calls) as calls,
sum(total_time) as total_time_ms,
avg(mean_time) as mean_time_ms,
avg(stddev_time) as stddev_time_ms,
sum(shared_blks_hit) as shared_blks_hit,
sum(shared_blks_read) as shared_blks_read,
sum(shared_blks_dirtied) as shared_blks_dirtied
from admin.pg_stat_statements()
where query ilike '%_postgrest_t%'
group by 1 order by mean_time_ms desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment