Remediation Hub (9)
Prune Old Chatwoot Notifications & Vacuum PostgreSQL Indexes
Batch-pruning notifications older than 60-90 days keeps PostgreSQL working sets inside host RAM and eliminates inbox query stalls.
Retention: 60-90 days | Recovery: 10-45 GB table/index bloat
Safe Batched Deletion Without Locking Production Inboxes
Never run an unbounded DELETE FROM notifications WHERE created_at < ... during support hours; a single huge transaction generates gigabytes of WAL and blocks agent reads. Instead run a weekly maintenance script or Rake task deleting 10,000 rows per batch with a 200 ms pause.
Reclaiming Index Pages with VACUUM ANALYZE and REINDEX
After batch pruning, run VACUUM ANALYZE notifications; and REINDEX TABLE CONCURRENTLY notifications; to shrink bloated B-tree indexes so PostgreSQL shared_buffers keeps active conversations hot in memory.
Measured Thresholds & Configuration
| Maintenance Step | Execution Frequency | Lock Impact |
|---|---|---|
| Batch prune notifications (> 90d) | Weekly (off-peak cron) | Minimal (10k row chunks) |
| VACUUM (ANALYZE) notifications | After every prune batch | Non-blocking |
| REINDEX TABLE CONCURRENTLY | Quarterly if bloat > 40% | Allows concurrent reads/writes |