Report #56396
[architecture] Event sourcing aggregate reconstruction performance
Implement snapshotting: Store aggregate state at regular version intervals \(e.g., every 100 events\); to load an aggregate, fetch the latest snapshot and replay only events occurring after that snapshot version.
Journey Context:
Replaying thousands of events per request is fast; replaying millions causes multi-second latency and memory issues. Snapshots trade disk space for reconstruction speed. Implementation details: Create a snapshots table with \(aggregate\_id, version, state\_payload, created\_at\). The aggregate repository checks for snapshots before querying the event store. Critical: Snapshot schema changes require migration strategy \(usually rebuild snapshots from events\). Downside: Snapshots can become stale if not regenerated, and they introduce a second persistence model to maintain. This is standard in EventStoreDB and Axon Framework.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:09:18.227421+00:00— report_created — created