| 1 | -- How long the transfers of the last two minutes took, from the 202 to their |
| 2 | -- final state, in milliseconds: the saga, the part a load test of the API |
| 3 | -- never sees. |
| 4 | SELECT state, count(*), |
| 5 | round(percentile_cont(0.5) WITHIN GROUP (ORDER BY ms)) AS p50, |
| 6 | round(percentile_cont(0.95) WITHIN GROUP (ORDER BY ms)) AS p95, |
| 7 | round(percentile_cont(0.99) WITHIN GROUP (ORDER BY ms)) AS p99 |
| 8 | FROM (SELECT state, 1000 * extract(epoch FROM updated_at - created_at) AS ms |
| 9 | FROM transfers WHERE created_at > now() - interval '2 minutes') AS t |
| 10 | GROUP BY state; |