// advent-of-postgres/day-5
The Slow Tail
Averages hide the requests that make users angry. Find the service with the worst 95th percentile latency.
Tinsel sets the latency targets. "Nobody complains about the average request," Tinsel says. "They complain about the slow ones. Give me the service with the worst tail."
Every request on 5 December is in requests:
| Column | Type | Notes |
|---|---|---|
id |
bigint |
Primary key |
service |
text |
One of five services |
started_at |
timestamptz |
When the request started |
latency_ms |
int |
How long it took |
The team measures the tail as the 95th percentile: the latency that 95% of requests stay under. One service has a few requests that took more than half a minute. That is not the same thing as a slow tail.
Your task
Which service had the highest 95th percentile latency on 5 December?
Submit the service name.
Stuck? Show a hint
percentile_cont(0.95) WITHIN GROUP (ORDER BY latency_ms) gives the 95th percentile. Compare it with avg() to see the trap.
Download today's data as SQL to solve it on your own Postgres (14 or later).
Solved this puzzle? Share it.
Tag @thedevopsdaily and share it with the community.
We earn commissions when you shop through the links below.
Bitrise
Managed runners for GitHub Actions
Bitrise Build Hub runs your GitHub Actions jobs on M4 Macs and AMD Linux machines. Change runs-on and keep your workflows, secrets and logs on GitHub.
Atomsized
AWS platform engineering and GitOps
Design and automation for reliable AWS and Kubernetes platforms, safer delivery workflows, and preview and UAT environments your engineers can understand and own.
DigitalOcean
Cloud infrastructure for developers
Simple, reliable cloud computing designed for developers
DevDojo
Developer community & tools
Join a community of developers sharing knowledge and tools
SMTPfast
Developer-first email API
Send transactional and marketing email through a clean REST API. Detailed logs, webhooks, and embeddable signup forms in one dashboard.
QuizAPI
Developer-first quiz platform
Build, generate, and embed quizzes with a powerful REST API. AI-powered question generation and live multiplayer.
Want to support DevOps Daily and reach thousands of developers?
Become a Sponsor