* 4 schedules

Cleanup Jobs

* In Plain English

Schedules for removing temp files, expiring sessions, and purging old records.

* Scheduling Guide

Cleanup jobs prevent unbounded growth in storage, session tables, and temporary directories. The schedule should be determined by how fast the resource grows — a high-traffic site accumulating thousands of sessions per hour needs hourly pruning, while a low-traffic internal tool can run a nightly sweep. Off-peak timing matters: deleting millions of rows during peak traffic competes for I/O and lock resources. A common pattern is to run the cleanup in small batches on a short interval (e.g. */10 * * * *) rather than one large delete at midnight, which spreads the database load and avoids long-running transactions. Always retain soft-deleted records for at least one billing cycle before hard-deleting to support auditability and accidental-delete recovery.

Related Topics