Storing blobs and denormalized data in rows: Database disk fills up in 9 days, not the planned 5 years
Storing blobs and denormalized data in rows debugging lab. The capacity plan said five years of storage. The disk alert fired at 85% after nine days. Row count matches the plan; table size doesn't.
Practice debugging a storing blobs and denormalized data in rows in a live, broken production system in your browser, with PostgreSQL. Find the root cause in the logs, terminal and code, fix it, and a load test checks that the fix holds under real traffic.
1. The Incident Context
The capacity plan budgeted about 1 KB per post and expected five years of storage. The disk alert fired at 85% after nine days. The row count matches the plan; the table size does not.
2. Observed Symptoms & Metrics
- Affected Endpoints / Components:
POST /posts, the posts and authors tables.
- Behavior: Every new post adds far more than 1 KB to the table. New posts still display correctly, so nothing looks broken until the disk fills.
- Error Rate: Zero. This is a storage problem, not a correctness problem.
- System Metrics: The
posts table grows ~2.4 KB per row instead of ~1 KB. A 1 MB photo stored as base64 is ~1.33 MB, plus a full copy of the author's profile.
3. Application Logs
08:12:02 posts service listening on :8080
08:12:30 posts table grew 2.4 KB per row this minute
08:12:31 disk usage at 85%, 9 days after launch
4. Your Objective
Step into the live environment while synthetic traffic is running, diagnose the root cause, and patch the codebase.
To clear this stack, your fix must satisfy these automated verification checks under a 60-second write burst:
- Row size: No post written during the burst is over 2 KB.
- Writes still work: Posts are created successfully during the burst.
Toolbox: curl -X POST localhost:8080/posts -d '{"authorId":1,"body":"hi","image":"..."}' -H 'Content-Type: application/json', psql "$DATABASE_URL" -c "SELECT pg_column_size(posts) FROM posts ORDER BY id DESC LIMIT 5", the app logs.
Each row stores the full image as base64 and a full copy of the author's profile. Put media in object storage and keep only a key, and store only the author id (join for display).
Save a file in the editor to rebuild and restart the app. Click Verify when you think it's fixed.
Your account and data
You can browse stacks without an account. To run labs you sign in with your email or Google account. BustedStack uses your email address to
sign you in, and your name and profile picture to show your account and pre-fill certificates. We never access your Gmail, contacts or Drive,
sell your data or run ad trackers.
Privacy Policy · Terms of Service · Browse stacks ·
hello@bustedstack.com
This site needs JavaScript to run labs.