How to Erase Personal Data When Events Are Never Deleted
Forgettable Payloads: The Good Reason for a Table
In my last article I argued that Event Sourcing should be the default, and that a table with the current state is the choice that needs a reason [1]. At the end I left one point open. Personal data must be deletable, and my example did not show how.
Since I started to apply and to talk about Event Sourcing, people keep asking me about exactly this point. An event is never changed and never removed. The GDPR gives a person the right to have their personal data erased [2]. How does this fit together?
It is a fair question, and the answer is simple. The GDPR is a good reason for a table. In this article, I'd like to show how little it actually takes.
The Usual Answer
If you search for this problem, you mostly find crypto-shredding. Every person gets a key. The personal data in an event is encrypted with this key, and for an erasure the key is deleted [3]. The events stay, and nobody can read the personal data in them any more.
This works well, and many event-sourced systems use it. However, it has a price. You need a key for every person and a place that stores these keys. If a key is lost, the data of this person is lost. If a key survives in a backup, the data is not erased. In addition, every read has to decrypt.
Another point is that the personal data is still in the store. It is only unreadable. Mathias Verraes, who described the pattern, asked himself whether a deleted key is a deletion in the sense of the law [3]. The European Data Protection Board states in its guidelines on blockchains that encrypted personal data is still personal data [4].
I think there is an easier way to solve this problem. Do not put personal data into an event.
A Number Instead of a Name
The personal data of a customer is a row in a table, and the table gives this row a number. An event holds only the number. An erasure deletes the row, and no event is touched.

This is not a new thing. Verraes described it in 2019 as Forgettable Payloads [3]. The Data Protection Board recommends the same for blockchains: personal data is kept outside the chain, so that it can be erased there [4]. A blockchain is not an event store, but the problem is the same, because both keep a record that is never changed.
I built a small example to show how this looks in code. It registers two customers, places three orders, erases one customer and checks what is left. The table is in a database beside the events.
Register and Order
A registration stores the name and the email address as a row, and it appends an event with the number of this row.
fn register(store: &EventStore, table: &Connection, person: (&str, &str)) -> Result<i64, Failure> {
let customer: i64 = table.query_row(INSERT, [person.0, person.1], |row| row.get(0))?;
let registered = event(CUSTOMER_REGISTERED, format!("customer {customer}"));
if let Err(error) = store.append(vec![registered], None) {
table.execute(DELETE, [customer])?;
return Err(error.into());
}
Ok(customer)
}
Notice that the payload of the event is customer 1 and nothing else. The row is stored first and the event after it. If the append fails, the row is deleted again.
An order is an event with the number of the customer and the item. For the list of orders, the program reads the OrderPlaced events and looks up the row of each customer. This is the only place where the events and the personal data come together.
Register 2 customers. The table gets name and email, the event gets the number.
customer 1 Ada Moore <ada@example.com>
customer 2 Bob Stone <bob@example.com>
Place 3 orders. An order is an event with the number of the customer.
customer 1 coffee grinder Placed
customer 2 desk lamp Placed
customer 1 water kettle Placed
The orders, with the personal data from the table.
order 1 coffee grinder Ada Moore <ada@example.com>
order 2 desk lamp Bob Stone <bob@example.com>
order 3 water kettle Ada Moore <ada@example.com>
The Erasure
Now Ada Moore asks for the erasure of her data. The program deletes her row and appends one event that says so.
fn erase(store: &EventStore, table: &Connection, customer: i64) -> Result<Answer, Failure> {
let query = Query::event_types([CUSTOMER_REGISTERED, CUSTOMER_ERASED]);
let who = format!("customer {customer}");
for _attempt in 1..=3 {
let selection = store.query(&query)?;
if !holds(&selection.records, CUSTOMER_REGISTERED, &who) {
return Ok(Answer::CustomerUnknown);
}
table.execute(DELETE, [customer])?;
if holds(&selection.records, CUSTOMER_ERASED, &who) {
return Ok(Answer::CustomerErased);
}
let erased = event(CUSTOMER_ERASED, who.clone());
match store.append(vec![erased], Some(selection.token))? {
Commit::Appended { .. } => return Ok(Answer::Erased),
Commit::Conflict => continue,
}
}
Ok(Answer::NotProcessed)
}
Notice that this function removes no event. The row is deleted first, so the personal data is gone even if the program stops before the append. The next erasure of this customer then appends the event.
Erase customer 1. The row is deleted, and one event says that it happened.
customer 1 Erased
The orders after the erasure. No order is lost.
order 1 coffee grinder customer 1, personal data erased
order 2 desk lamp Bob Stone <bob@example.com>
order 3 water kettle customer 1, personal data erased
An order for the erased customer is refused.
customer 1 tea pot CustomerErased
All three orders are still there. The business still knows that a coffee grinder and a water kettle were ordered, and it needs this for its stock and its revenue. It no longer knows who ordered them.
The last line shows why the erasure is an event. A new order for customer 1 is refused, and the rule behind it does not look into the table. It reads the CustomerRegistered and CustomerErased events and checks them:
if !holds(&selection.records, CUSTOMER_REGISTERED, &who) {
return Ok(Answer::CustomerUnknown);
}
if holds(&selection.records, CUSTOMER_ERASED, &who) {
return Ok(Answer::CustomerErased);
}

The Events Stay
After the run, the store holds six events.
All events in the store. No event holds a name or an email address.
1 CustomerRegistered customer 1
2 CustomerRegistered customer 2
3 OrderPlaced customer 1: coffee grinder
4 OrderPlaced customer 2: desk lamp
5 OrderPlaced customer 1: water kettle
6 CustomerErased customer 1
No event was changed or removed for the erasure. The program then checks what is left of both customers. It counts their rows in the table, and it searches the bytes of the event store for their names and email addresses.
What is left of the 2 customers.
Ada Moore, ada@example.com rows in the table: 0 found in the event store: 0
Bob Stone, bob@example.com rows in the table: 1 found in the event store: 0
Ada has no row any more, and Bob still has his. The event store holds neither of them, because no event ever held them. This means that there is nothing to shred and no key to manage.

Watch the example from this article in a 90-second video.
What About Transactions?
There is none across the two writes. The table and the events are two stores, so one transaction cannot cover both. The example works with the order of the writes instead.
An erasure deletes the row first. If the append fails or the program stops in between, the personal data is already gone and only the event is missing. Until then the rules do not know about the erasure, and a new order for this customer would still be accepted. Therefore the caller repeats the erasure. The second run finds no row to delete and appends the event. The erasure counts as done only when the answer is Erased.
A registration stores the row first. If the append fails, the row is deleted again. If the program stops in between, a row stays that no event refers to. The example does not clean this up. An application would delete the rows whose number has no CustomerRegistered event.
The other order would be the wrong one. Then an event could say that a customer is erased while the row still exists.
If the events and the table are in the same database, one transaction covers both writes, and the question does not come up.
Is the Store Still the Truth?
Verraes names the price of this approach. The event store is no longer the single source of truth, because a reader of the events needs the table as well [3].
I do not see this as a problem. In my last article I wrote that a table needs a reason. Here it has one, and the reason is the law. The table holds what the law wants to be erasable, and nothing else.
Everything that happened is still in the events. Every rule of the application reads events only, as the refused order shows. The table is needed in one place, where a person is shown with their name.
Is the Number Personal Data?
Yes, as long as the row exists. The GDPR calls this pseudonymization. The number leads to a person for everyone who has the table, and therefore the events of this customer are personal data as well [2].
After the erasure the number leads to nobody, if nothing else in the events does. This is the part you have to take care of. A delivery address, a phone number or a free text such as a note on an order can identify a person. For this reason they belong in the table and not in an event. Verraes gives an example where a relation is enough: an erased customer who is still stored as the friend of two known customers [3].
In practice, you ask the same question for every field of an event. Can it lead back to a person? If it can, it goes into the table.
The Limits
Three things are not solved by the table alone.
1) Backups. A backup of the table holds the row until the backup is replaced.
2) Deleted rows in files. A database does not overwrite a deleted row at once. In PostgreSQL the bytes stay in the table file at least until a VACUUM, and the write-ahead log holds them longer. In DuckDB they stay until the database is copied into a new file.
3) Data you must keep. Some data has to be kept for years by law, invoices for example. The right to erasure does not apply as long as such an obligation exists [2]. Then the row stays until this time is over.
You have all three with every table of personal data, with or without Event Sourcing. I am a developer and not a lawyer, so check your own case with someone who is.
Conclusion
Many applications will never need this. A warehouse app stores goods movements and no personal data, and events are the only thing it stores. The table comes with the first feature that stores a name, and it holds only what a person can ask you to erase. Everything else remains as an event.
Cheers!

Sources
[1] Rico Fritzsche, "Why Event Sourcing Should Be the Default"
[3] Mathias Verraes, "Eventsourcing Patterns: Forgettable Payloads" and "Eventsourcing Patterns: Crypto-Shredding", 2019
[4] European Data Protection Board, "Guidelines 02/2025 on processing of personal data through blockchain technologies", version 2.0, 2026
