Sequence # instead of datetime in historic? #56
-
Curious about the rationale for using a sequence number vs a datetime. Both work to order the events, but maintaining the sequence number seems like it would lead to transaction conflicts. Is there a situation where the sequence number is more useful/efficient/desired than a datetime? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's the subject of much debate in several event sourcing projects. Transaction conflicts aren't really an issue as the sequence number is obtained within the same transaction as an event is written. #35 is about avoiding the spurious transaction problems that can arise under heavy load. The sequence number absolutely guarantees order. There is no possibility of identical values, as there is with a timestamp. It also identifies a record for play and rewind by projections rather than attempting to hold the time to which they've been played (which is tricky and error prone). |
Beta Was this translation helpful? Give feedback.
That's the subject of much debate in several event sourcing projects.
Transaction conflicts aren't really an issue as the sequence number is obtained within the same transaction as an event is written.
#35 is about avoiding the spurious transaction problems that can arise under heavy load.
The sequence number absolutely guarantees order. There is no possibility of identical values, as there is with a timestamp. It also identifies a record for play and rewind by projections rather than attempting to hold the time to which they've been played (which is tricky and error prone).