0001 · The Record store is PostgreSQL
Status: accepted, 2026-09-23. Not yet proven.
Context
The Record is append-only, and the money projections (positions, cash, orders) must change in the same transaction as the event that changed them (§24, R-ARCH). Replay must give byte-identical output years later (§29.1, spike 6). The kernel reads frozen inputs and must answer inside its latency budget (spike 3). One person runs backup, restore and upgrades (§28.1, criteria 1 and 4).
Decision
PostgreSQL holds the event log and every money projection, in one database, with append-only enforced by grants and triggers rather than by convention.
Alternatives
- An event-streaming platform as the primary store. Rejected: point-in-time queries and transactional money updates both become harder, and it adds a cluster to operate (§28.3).
- SQLite. Close second: one file, trivially backed up. Rejected for the concurrent writers the gateway, the scheduler and the seats create, and for weaker replication to a second site.
- A managed document database. Rejected: weaker constraints at the money boundary, and a vendor inside the fund's measurement horizon.
Consequences
- Constraints, foreign keys and transactions catch the errors that cost money (§28.1, criterion 2).
- Backup, point-in-time recovery and replication are mature and documented. The restore drill uses standard tools.
- The owner operates one database server, and must keep up with its major-version upgrades.
Falsifier
Any of these overturns the decision:
- the kernel's worst-case read of its frozen inputs exceeds its budget on a year of replayed decisions;
- replay of a week produces any divergence traceable to the store (ordering, time zones, floating point, collation);
- the append-only guarantee can be bypassed by a role the services hold.
Validated by
Spike 3 (the kernel) and spike 6 (replay). Measurements: to be written here.