Skip to content

Instantly share code, notes, and snippets.

@kylefritz
Created December 20, 2017 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefritz/948e5928391ca7daa05ccf914d6d8e91 to your computer and use it in GitHub Desktop.
Save kylefritz/948e5928391ca7daa05ccf914d6d8e91 to your computer and use it in GitHub Desktop.
select
date_trunc('day', enqueued_at) as enqueued_at
,last_stage
,count(*)
,round(percentile_cont(0.50) WITHIN GROUP (ORDER BY duration_minutes)) as p50
,round(percentile_cont(0.75) WITHIN GROUP (ORDER BY duration_minutes)) as p75
,round(percentile_cont(0.90) WITHIN GROUP (ORDER BY duration_minutes)) as p90
,round(percentile_cont(0.95) WITHIN GROUP (ORDER BY duration_minutes)) as p95
from queue_stat
GROUP BY 1,2
ORDER BY 1,2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment