Problem
The pgboss.job table in the notifications service grows unbounded with completed jobs. In production we observed ~791K rows (440K created, 350K completed), causing:
- 24MB temp files on every poll query — the pg-boss work query (SELECT ... FOR UPDATE SKIP LOCKED) cannot sort in memory, creating ~24MB temp files every ~250ms
- Connection drops — excessive I/O from the bloated table causes Broken pipe / connection to client lost errors
- Container restart loops — connection loss triggers pg-boss stopped event, health check fails, orchestrator kills container, backlog grows
The maintenance cycle that should clean up completed jobs never completes because pg-boss keeps crashing and restarting before it runs.
Action needed
Implement proper cleanup of completed jobs from the pgboss.job table.
Problem
The pgboss.job table in the notifications service grows unbounded with completed jobs. In production we observed ~791K rows (440K created, 350K completed), causing:
The maintenance cycle that should clean up completed jobs never completes because pg-boss keeps crashing and restarting before it runs.
Action needed
Implement proper cleanup of completed jobs from the pgboss.job table.