Activity Records - Why a Separate Database
2 min read
Activity Records needs its own PostgreSQL server. A new database on the platform's server is not enough.
It is the audit trail. It must keep its history, keep working and stay protected, even when the rest of the platform has a problem. A shared server cannot promise that.
Size and Cost
The extra server is small. Unique runs the same size on UAT.
Server |
|
|---|---|
Storage | 32 GB, grows by itself when needed |
Backups | 30 days, free up to the storage size |
Cost per month | About CHF 162 |
Azure list prices for Switzerland North, 730 hours a month, before discounts. Each extra GB of storage adds CHF 0.125 a month.
The Reasons
1. Backups and restores stay separate. Managed PostgreSQL, Azure included, backs up and restores per server, not per database. On a shared server, restoring the platform after a bad migration also rolls back the audit trail, and the newer records are gone unless someone copies them by hand.
2. Heavy writes do not slow down chat. Every action is a new row. Disk, memory and CPU belong to the server, so a burst of tool calls on a shared server slows down chat for everyone.
3. Only Activity Records can connect. Its own server has its own credentials and network rule. A leaked platform database password does not open the audit trail. Keeping audit records apart from the system they audit is a common security control (NIST SP 800-53, AU-9(2)).
4. The table only grows. Records are never deleted for now, and storage on Azure can grow but never shrink. On a shared server, this makes the platform's backups bigger and its restores slower.
5. Failures stay separate. A long migration or a lock on the platform server does not stop audit writes. A full disk on the audit server does not stop chat. If the audit server is down, events wait and are saved later.
How Big It Gets
A record is about 1 KB. Tool calls are larger, because they also keep the tool's input and output (up to 1 MiB, compressed on disk).
To estimate: records per day × 365 × average record size. To measure: after a week, divide the storage used by the record count (metric unique_activity_records_stored_records).