// advent-of-postgres/day-2
The Error Budget
Every service has an error budget. Find the service that burned the most of it on 2 December, without letting a tiny service or integer division fool you.
Bushy keeps the error budgets. Each service may fail a small share of its requests before the team stops shipping features and fixes reliability instead. The dashboard broke overnight, so Bushy needs the numbers from the database.
Every service writes one row per minute to request_stats:
| Column | Type | Notes |
|---|---|---|
service |
text |
Part of the primary key |
minute |
timestamptz |
The start of the minute, 2 December only |
requests |
int |
Requests served in that minute |
errors |
int |
How many of them returned a 5xx |
Some minutes had no traffic at all. One service is a small export job that serves only a few thousand requests a day.
Your task
The error rate of a service is its total errors divided by its total requests over the whole day. Counting only services that served at least 10,000 requests on 2 December, which service had the highest error rate?
Submit the service name.
Stuck? Show a hint
Integer divided by integer is an integer in Postgres. And check what the 10,000-request floor removes.
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