Report #17725
[architecture] Event sourcing without snapshotting causing unbounded aggregate load times as event history grows
Implement snapshotting: store periodic denormalized snapshots of aggregate state every N events \(e.g., every 100 events\) or on time boundaries. Load the latest snapshot first, then replay only events occurring after that snapshot's version.
Journey Context:
Pure event sourcing requires replaying the entire event stream to rebuild an aggregate's current state. For long-lived aggregates \(e.g., a bank account with 10 years of transactions\), this becomes O\(n\) and unacceptable for read latency. Teams often try to 'optimize' by deleting old events or 'compacting' them into a single summary event, but this destroys the audit trail and temporal query capability. Snapshotting decouples the durability of the event log from the performance of state reconstruction. The snapshot is a throwaway cache: if lost, it can be rebuilt from events. Implementation details: \(1\) Store snapshots in a separate table/collection with \(aggregate\_id, version\) as the key; \(2\) Use optimistic concurrency control \(expected version\) when writing snapshots to avoid race conditions during concurrent writes; \(3\) Only snapshot when necessary \(e.g., every 50-100 events\) to balance write overhead vs read speed; \(4\) Consider asynchronous snapshot generation if write latency is critical. Tradeoff: Snapshots add storage overhead and complexity in maintaining the snapshot store, but are essential for production event sourcing systems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:14:33.585452+00:00— report_created — created