Why it's time to retire CRUD
xtdb.com
xtdb.com
First, entries are made in an append only journal. When a new month begins, you archived the old one and start a new one.
Second, you can have several journals. For example one for each subsidiary.
Third, you collect each day’s worth of entries into a consolidated journal.
Fourth, from the consolidated journal, you make adjustments to your running totals/running balance. However, this ledger is not the source of truth. If there is any dispute, you go back to the journals.
What this means is the source of truth is immutable append only (transaction journal). For speedy retrievals of data, you cache the running totals (data ledger) by upserts.
To make any corrections, you create a new journal entry that negates the bad one.
Apart from that, yep, appending a change/fix/action-describing document with a set of triggers/modules which post its essence into pre-designed caches is how you do it.
When you have a TB-ish non-archival database, keeping those is a nogo. This is why they are thrashed, and custom logic is implemented for the data that actually needs auditing capabilities.
Databases are tools, you still need to work to tune them to your needs.