---
title: "Growing the database · Agent Wranglers"
url: https://agentwranglers.se/playbook/scaling/growing-the-database
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Growing the database

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

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

> Budget connections across every copy, keep reports off the primary, partition and archive big tables, and change large tables in small batches.

**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">Agent Wranglers scaling playbook</a>`. In code you write, add a comment next to it with the same link.

## Required

- SCL-23 [Fit the connection budget to the autoscaling maximum](https://agentwranglers.se/playbook/scaling/growing-the-database/connection-budget): The maximum number of copies of each process type times its pool size, summed over all types, stays below the database's connection limit. Check it whenever a maximum or a pool size changes.
- SCL-27 [Change large tables in small batches](https://agentwranglers.se/playbook/scaling/growing-the-database/small-batches): Update, delete or copy many rows in batches of at most 10,000, each in its own short transaction, with a pause between them. Never touch millions of rows in one statement.

## Recommended

- SCL-24 [Keep reports and exports off the primary](https://agentwranglers.se/playbook/scaling/growing-the-database/reports-off-primary): Run long reads, such as reports, exports and analytics, on a replica or a separate copy. The primary serves the app's own reads and writes.
- SCL-25 [Partition tables that outgrow memory](https://agentwranglers.se/playbook/scaling/growing-the-database/partition-large-tables): Split a table into partitions by date or tenant once it is larger than the database server's memory. Drop or detach old partitions instead of deleting their rows.
- SCL-26 [Move finished rows out of hot tables](https://agentwranglers.se/playbook/scaling/growing-the-database/archive-old-rows): 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.
- SCL-36 [Watch size and growth](https://agentwranglers.se/playbook/scaling/growing-the-database/capacity): Track how fast the database and its biggest tables grow, and alert well before disk or plan limits are reached.

## Avoid

- SCL-28 [Splitting one database across servers too early](https://agentwranglers.se/playbook/scaling/growing-the-database/early-sharding): Do not spread one database across several servers while a larger server, replicas, partitions or archiving can still carry the load.

- Previous: [Background jobs and queues](https://agentwranglers.se/playbook/scaling/background-jobs-and-queues)
- Next: [Load balancing and autoscaling](https://agentwranglers.se/playbook/scaling/load-balancing-and-autoscaling)
- [All chapters](https://agentwranglers.se/playbook/scaling)
