Quick revision
The short answer
I would not add history tables to every operational database. I would classify which data has real business, legal or analytics value, capture changes centrally with change data capture into cheap object storage with tiered retention, respect privacy rules that forbid keeping personal data forever, and give the history stream owners and versioned schemas so it is still usable in five years.
What to remember
In this answer, we saw that 'full history forever' is really several needs with different lifetimes. We classify data by business, legal and analytics value, capture history centrally with CDC into object storage rather than history tables in every database, estimate storage and query cost from change rates and use tiers, align retention with privacy and erasure duties, and give the history stream owners and versioned schemas so it stays useful.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would not add history tables to every operational database. I would classify which data has real business, legal or analytics value, capture changes centrally with change data capture into cheap object storage with tiered retention, respect privacy rules that forbid keeping personal data forever, and give the history stream owners and versioned schemas so it is still usable in five years.
Why this question is asked
'Keep everything forever' sounds safe, and that is why leaders ask for it. In practice it can double the cost of every database, slow down writes, and quietly break privacy law. A senior engineer is expected to turn a vague wish into a design with a price, a legal position and an owner. Interviewers ask this to see whether we can push back constructively and still give leadership what they actually need. In this answer, we will separate the real goals behind the request, decide what deserves history, design central capture, estimate the cost, deal with retention and erasure, and set up governance.
1What Leadership Actually Wants
Behind 'full history of everything' there are usually three different needs. Auditors want to prove who changed what and when, for a defined set of records such as payments and permissions. Analysts want to see trends over time, such as how order statuses moved during a quarter. And engineers want to debug incidents by looking at a row's earlier states.
These needs differ in how long the data must live, how fast it must be queried and who may see it. Audit data may need seven years and strict access. Analytics wants years of data but tolerates a delay of minutes. Debugging needs only weeks. Treating them as one requirement leads to the most expensive answer for everything.
2Classifying the Data First
So the first step is an inventory. For each table we record its owner, whether it contains personal data, whether a law or contract requires its history, and whether anyone has asked to analyse its changes. A session cache table or a job queue has no history value at all, while a ledger already is history and needs no extra copy.
In a typical estate, perhaps a fifth of tables carry most of the value. Classification also tells us where history must be exact, such as audit of financial records, and where a daily snapshot is enough.
| Class | Example tables | History kept | Retention |
|---|---|---|---|
| Regulated audit | payments, account permissions | every change, with actor | 7 years, then delete |
| Analytics | orders, subscriptions | every change via CDC | 3 years hot, then archive |
| Personal profile | customers, addresses | changes, pseudonymised | per privacy policy |
| Operational noise | sessions, job queues, caches | none | none |
3Capturing History Centrally With CDC
Change data capture, or CDC, reads the database's own change log (the write-ahead log in PostgreSQL, the binlog in MySQL) and turns each committed insert, update and delete into an event. A tool such as Debezium publishes these events to Kafka, and a sink writes them into open table formats such as Apache Iceberg or Delta Lake on object storage.
The reason this beats history tables in each OLTP database is that it costs the operational database almost nothing. There are no triggers adding writes to every transaction, no history tables bloating backups, and no extra vacuum work. Every team gets history the same way, and it lands in storage that costs a small fraction of database disk.
4Estimating the Cost
Leadership deserves numbers before deciding. Suppose our databases change 500 million rows per day and an average change event is 1 KB. That is about 500 GB of raw events per day. Columnar formats like Parquet often compress such data five to ten times, so we store roughly 50 to 100 GB per day, which is 18 to 36 TB per year.
Object storage prices vary by provider and tier, but the infrequent and archive tiers cost a fraction of the standard tier, and database disk with replicas is far more expensive per terabyte. So we keep, for example, 90 days in the standard tier for fast queries, move older data to infrequent access, and push data older than three years to archive. Query cost matters too: analysts scanning years of raw events are billed by data read, so we publish compacted daily snapshots and partition by date so most queries read a small part.
The useful message is a curve, not a single figure: the cost of 'forever' grows every year, while the value of a seven-year-old change to a shopping cart is close to zero.
- Operational databasesPostgreSQL and MySQL, no history tables
- CDC connectorsread WAL or binlog, publish change events
- Kafka topicsone per table, schemas in a registry
- Lakehouse tablesIceberg or Delta, partitioned by date
- Storage tiers90 days hot, 3 years warm, archive or delete
5 layers, from the top down. Step through them one at a time.
5Retention and the Right to Erasure
'Forever' collides with privacy law. Under rules such as the GDPR, a customer can ask us to erase their personal data, and we must not keep personal data longer than its purpose needs. A history store that copies every change to the customers table keeps old names, emails and addresses in hundreds of files we never planned to rewrite.
There are three practical answers. We can pseudonymise personal fields during capture, replacing them with a stable token so analytics still works. We can encrypt each person's data with a per-person key and delete the key on erasure, which is called crypto-shredding. And we can rely on the delete and rewrite support of formats like Iceberg to remove rows, with a scheduled job that honours erasure requests. Whatever we choose, every class gets a written retention period, approved by legal, and data past it is actually deleted.
6Governance That Keeps History Usable
History that nobody owns becomes unreadable. Columns get renamed, types change, and five years later nobody knows what status 7 meant. So every history topic has an owning team, its schema is registered with compatibility rules (adding optional fields is fine, renaming is not), and breaking changes go through review.
We also publish a catalogue entry for each dataset that states its meaning, owner, classification and retention, and we measure use. If a dataset has not been queried for a year and has no legal hold, it is a candidate for shorter retention. That review loop is what stops the cost curve from growing without limit.
7Follow-up questions
Is there any case for history tables inside the OLTP database?
Yes, when the application itself must read history in the same transaction, for example showing a contract's previous versions to the user or enforcing a rule that depends on past values. Then a history table or a bitemporal model in that one domain is right. It is the blanket rule for every table that we avoid.
What do we do about deletes in the source database?
CDC emits delete events, often followed by a tombstone in Kafka. The history store should keep the delete as an event with its timestamp, so analysts can see that the row disappeared, unless the delete was an erasure request, in which case the earlier copies must be removed too.
How do we handle schema changes over years?
We use a schema registry with backward compatibility, version every change, and write the lakehouse tables with schema evolution enabled so old and new files can be read together. A data contract between the producing team and consumers states what may change without notice.
8Conclusion
In this answer, we saw that 'full history forever' is really several needs with different lifetimes. We classify data by business, legal and analytics value, capture history centrally with CDC into object storage rather than history tables in every database, estimate storage and query cost from change rates and use tiers, align retention with privacy and erasure duties, and give the history stream owners and versioned schemas so it stays useful.
Open with
I would agree with the goal but not with the literal rule. First I would ask what the history is for, because audit, analytics and debugging need different retention and access.
Then, if they want more
Then I would classify our tables: regulated records like payments need every change for a fixed period, analytics tables need changes for a few years, and things like sessions or queues need none. For capture, I would not put history tables or triggers in every OLTP database, since that adds write cost and backup size everywhere.
Instead I would use CDC, for example Debezium reading the WAL or binlog into Kafka, and land the events in Iceberg or Delta tables on object storage, partitioned by date.
I would show leadership a cost estimate based on change rates, say 500 million changes a day at about 1 KB, which compresses to tens of terabytes a year, and use storage tiers so old data is cheap or deleted.
'Forever' also conflicts with privacy law, so personal fields are pseudonymised or crypto-shredded and every class has an approved retention period. Finally, each history stream gets an owner, a registered schema with compatibility rules and a catalogue entry, so it is still usable years later.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Leadership wants 'full history of everything' kept forever for analytics and audits...": https://scrivio-interview-library.netlify.app/databases/data-modeling/b7ceda0085/