I'm learning event sourcing pattern I can not understand one thing at it.
There is the instruction to not store the current state of entity at DB in many tutorials. Developer should build an infrastructure for extracting all events ("event stream") from DB that is related to this entity, afterwards it applies them to new needed-type object, so finally it's the current state.
Let it be an bank account. To return to my client her current account state I must:
- Extract all related events (possibly there are thousands events at DB)
- Compute amount of free money at that moment.
However what about performance? I think it's would be better just to store the current state of every account and a new event would create side-effect to it immediately. Am I not right?
Aucun commentaire:
Enregistrer un commentaire