// advent-of-postgres/day-19
The Disk That Fills Up
Fit a line to two weeks of disk usage and find the host that runs out of space first. The fullest disk today is not the answer.
Nobody wants a full disk on 24 December. Wunorse asks you which host will run out of space first if things keep growing the way they have for the last two weeks.
Every host reports its disk usage every six hours to disk_usage:
| Column | Type | Notes |
|---|---|---|
host |
text |
Part of the primary key |
measured_at |
timestamptz |
Every 6 hours, from 5 December |
used_gb |
numeric(8,2) |
Space used |
size_gb |
int |
Size of the disk |
The measurements are noisy, so use the least-squares line through all of a host's points as its growth rate. The free space is the size minus the usage at the host's last measurement.
Your task
At its own growth rate, which host runs out of disk space first?
Submit the host name.
Stuck? Show a hint
regr_slope(used_gb, extract(epoch from measured_at)) is the growth in GB per second. Divide the free space at the last measurement by it.
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