---
title: "Move finished rows out of hot tables · Agent Wranglers"
url: https://agentwranglers.se/playbook/scaling/growing-the-database/archive-old-rows
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Move finished rows out of hot tables

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Growing the database](https://agentwranglers.se/playbook/scaling/growing-the-database.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- ID: SCL-26
- Level: Recommended
- Chapter: [Growing the database](https://agentwranglers.se/playbook/scaling/growing-the-database)
- Rule: Move rows the app no longer changes, such as orders closed more than 2 years ago, into an archive table or store. The hot table keeps what daily work touches.
- How: Index size and vacuum work grow with the table, so old rows slow every write. Agree with the business when a row counts as finished. Copy and delete in batches, as [Change large tables in small batches](https://agentwranglers.se/playbook/scaling/growing-the-database/small-batches) says. Keep the archive readable for support and for bookkeeping law. Deleting personal data when its time ends is a separate rule, [Delete old data automatically](https://agentwranglers.se/playbook/data/personal-data/retention-jobs). A partitioned table archives by detaching its old partitions.
- Check: The archive job reports a heartbeat after each run. The hot table holds no finished row older than the agreed age plus 1 month.

## Related rules

- [Change large tables in small batches](https://agentwranglers.se/playbook/scaling/growing-the-database/small-batches) in Scaling
- [Delete old data automatically](https://agentwranglers.se/playbook/data/personal-data/retention-jobs) in Data

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/scaling/growing-the-database/archive-old-rows">Agent Wranglers scaling playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Partition tables that outgrow memory](https://agentwranglers.se/playbook/scaling/growing-the-database/partition-large-tables)
- Next: [Change large tables in small batches](https://agentwranglers.se/playbook/scaling/growing-the-database/small-batches)
- [Growing the database](https://agentwranglers.se/playbook/scaling/growing-the-database)
