// advent-of-postgres/day-11
The Cloud Bill
Finance wants to know the day one team blew through its December budget. A running total answers it, if the window is right.
Every team has a December cloud budget of 10,000 candy canes. The wrapping team had a rough first week, and finance wants the exact day the team went over.
Each team's spend per day is in daily_costs:
| Column | Type | Notes |
|---|---|---|
team |
text |
Part of the primary key |
day |
date |
1 to 24 December |
cost |
int |
Candy canes spent that day |
The table already has the planned spend for the rest of the month, so the answer can be later than today.
Your task
On which day did the wrapping team's running December total first reach 10,000 candy canes or more?
Submit the date as YYYY-MM-DD.
Stuck? Show a hint
sum(cost) OVER (ORDER BY day) is a running total. Filter to one team first, or partition by team.
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