Re:Highly opinionated SQL schema design to put you on the fa...
by McMini on Wednesday April 26, 2023 @04:47AM
(#35711005)
What are the key trade-offs in your approach vs doing event sourcing?
Re:Highly opinionated SQL schema design to put you on the fa...
by hot_gril on Wednesday April 26, 2023 @12:32PM
(#35716350)
Tbh I had to just look up event sourcing. Seems like my approach includes a form of event sourcing, though I'm not always storing the ordering of events, only in cases where it's needed. And that concept isn't specific to relational DBs.
You can also do this without making such an exception. I used to keep a separate "pending" table that I'd insert into, commit, then check the balance with the pending row included before moving it to non-pending. So two transactions. That worked, problem is it was annoying. Though it was a good solution for debits/credits that involved an async external step that could fail or time out; simply ignore the pending rows that are too old and never got resolved. 30K rows is still small enough to query quickly.