Database vacuum service disabled by default allows performance-degrading data accumulation
warningperformanceUpdated Apr 24, 2025(via Exa)
Technologies:
How to detect:
Prefect's database vacuum background service is disabled by default, allowing old flow runs, task runs, and state records to accumulate indefinitely. Over time this degrades query performance even with adequate hardware resources.
Recommended action:
Enable the database vacuum background service via settings to automatically clean old data. Implement manual data retention flows using client.delete_flow_run(flow_run_id) for runs older than your retention period (e.g., 60 days). For immediate cleanup, directly delete old rows from task_run_state and task_run tables, then run VACUUM ANALYZE on those tables.