No trace held the erased user's e-mail. The table's file held it 6 times, and 4 mentions were never found.

After erasure, 0 traces held a user's e-mail, yet the Postgres 17 table file held 6 copies until VACUUM FULL, and 4 of 4 other mentions survived.

Published
Updated
Reading time
16 min read
An erased user's e-mail counted in a Postgres 17 trace store before the erasure, after DELETE and UPDATE, after VACUUM, after VACUUM FULL and after 32 MB of unrelated writes: 6, 6, 3, 0 and 0 copies in the trace table's file; 5, 5, 2, 0 and 0 in the recorded responses' file; 12, 24, 24, 24 and 0 in the write-ahead log An erased user's e-mail counted in a Postgres 17 trace store before the erasure, after DELETE and UPDATE, after VACUUM, after VACUUM FULL and after 32 MB of unrelated writes: 6, 6, 3, 0 and 0 copies in the trace table's file; 5, 5, 2, 0 and 0 in the recorded responses' file; 12, 24, 24, 24 and 0 in the write-ahead log
The check said 0. The file still held 6 copies until VACUUM FULL.
On this page

I erased one user from a model of an LLM trace store and checked it the way a request for proof would: no trace and no recorded response held the user’s e-mail or name, or was keyed to them. 0 rows. Then I counted the e-mail in the table’s own file. It was there 6 times, and the write-ahead log held it too.

A query reads rows, and the file still held the bytes of the rows that had been deleted. There was a second gap. Erasure found the user by e-mail and full name, and 4 of 4 mentions of the same person written another way, such as the address spelled out with “at” and “dot”, were still in other users’ traces.

A trace store is a personal-data store. The prompts, the data the model was given and the answers are kept for observability and evaluation, and customers type names and e-mail addresses into their questions. It has the same erasure duty as the warehouse. What differs is where the copies sit.

Operating rule. Give the trace store three things: a retention window that bounds every exposure, a physical rewrite of the tables an erasure touched, and a stated limit on what erasure by identifier can find. Bound the write-ahead log and the backups by time as well, and re-apply the erasure log after any restore.

The test

This is the drill behind decision 0013 of ai-platform-architecture, run on Postgres 17.11 in a container. The store is a model of a trace store in two tables: trace, which holds the question, the SQL, a result summary and the model, and recorded_response, which holds the prompt and the model’s reply. They hold 5,000 synthetic traces, each with its recorded response, spread evenly over the last 60 days for 200 users in 20 accounts. A third table, identity, stands in for the platform’s identity table, where erasure learns a user’s e-mail and name. Autovacuum is off on the two tables, so the steps are the only thing that cleans them.

  1. Retention. One DELETE per table, in one transaction, for rows older than 30 days.
  2. Erasure of one user. Delete the user’s own rows. In everyone else’s rows, replace the user’s e-mail and full name with [erased], case-insensitively and on word boundaries. Write one audit row with no identifier.
  3. Proof by counts. Rows keyed to the user, and rows holding the e-mail or name, scored against the seed’s ground truth, which records which row mentions whom and in which form.
  4. Proof by bytes. After a CHECKPOINT, count the e-mail and the name as text in the tables’ files, their TOAST files and every file of pg_wal, after each step below.
  • 0 of 2,500traces and 0 of 2,500 recorded responses older than 30 days left after the retention job
  • 0traces or recorded responses holding the erased user's e-mail or name, or keyed to them, after erasure
  • 4 of 4mentions of the user written another way that erasure by e-mail and name did not find

Postgres 17.11 in a container; 5,000 synthetic traces, each with its recorded response, spread evenly over 60 days for 200 users in 20 accounts; one DELETE per table in one transaction for the retention job; scored against the seed's ground truth; re-run in CI on a fresh database.

The retention job and the row-level proof passed. The third figure is why that proof is incomplete, and the rest of this post follows what it cannot see.

Where the copies were

The stepper walks one erased user’s e-mail through the store. The first tab follows the copies in the files, step by step. The second follows the mentions that erasure by pattern did not find.

What erasure leaves behind in the trace store

Identity tablee-mail and name
ErasureDELETE, UPDATE, VACUUM
Trace table's fileafter CHECKPOINT
Write-ahead logpg_wal, 16 MB segments

In the files: copies of the erased user's e-mail after each step

Autovacuum off on the two tables, so the steps are the only thing that cleans them

  1. After seeding, before the retention job and the erasure. The store is two Postgres tables, trace and recorded_response. After a CHECKPOINT, the e-mail of the user about to be erased is in the table files and in the log. Copies in the trace table's file: 6. Copies in the recorded responses' file: 5. Copies in the write-ahead log: 12.
  2. DELETE removes the user's own rows, and UPDATE replaces the e-mail and name in other users' rows with [erased]. Nothing is overwritten: a deleted row stays in the file until something cleans it up, and an updated row leaves its old version beside the new one. Copies in the trace table's file: 6. Copies in the recorded responses' file: 5. Copies in the write-ahead log: 24.
  3. VACUUM frees the space the dead rows held without clearing it. Half the copies of the e-mail are left in the trace table's file. The user's full name did worse: 5 of 6 copies left there. Copies in the trace table's file: 3. Copies in the recorded responses' file: 2.
  4. VACUUM FULL rewrites each table into a new file. The table files hold no copy of the e-mail and none of the name. The write-ahead log still holds the address. Copies in the trace table's file: 0. Copies in the recorded responses' file: 0.
  5. Unrelated writes, 16 MB at a time with a CHECKPOINT after each, overwrite the log's segments. It took 32 MB (min_wal_size 80 MB, 16 MB segments), and the address was gone from the log. Copies in the write-ahead log: 0.

By the pattern: the same user, written other ways

Erasure matches the e-mail and the full name, case-insensitively and on word boundaries

  1. Erasure learns the user's e-mail and full name from the identity table. The user's own 12 traces and 12 recorded responses are deleted outright. Two other users' traces and responses name the user 6 times, by e-mail or full name.
  2. UPDATE replaces each match with [erased]. A shorter address inside a longer one is left alone, and those rows are otherwise unchanged. Mentions replaced with [erased]: 6.
  3. The check, scored against the seed's ground truth: no trace or recorded response holds the user's e-mail or name, or is keyed to the user. Traces holding the e-mail or name: 0.
  4. Four other mentions of the same user were written another way: the address spelled out with 'at' and 'dot' (1), the first name alone (2) and the surname alone (1). A match on e-mail and name does not find them, and all 4 are still there. Written another way, still there: 4 of 4.
  5. Each still expires with its row inside 30 days, so what these 4 expose is bounded by the retention, not by the erasure.
Postgres 17.11, 5,000 synthetic traces, one erased user; copies counted as text in the table files and in pg_wal after a CHECKPOINT.
Step Trace table file Recorded responses file Write-ahead log
After seeding, before the retention job and the erasure 6 5 12
After DELETE and UPDATE 6 5 24
After VACUUM 3 2 24
After VACUUM FULL 0 0 24
After 32 MB of unrelated writes 0 0 0

Each step is one of the drill’s counts, taken after a CHECKPOINT. The three columns are one count in three places, and the log’s column goes up while the files’ columns go down.

DELETE and UPDATE removed no bytes. A deleted row stays in the file until something cleans it up, and an UPDATE writes the new version beside the old one. After the erasure the trace table’s file still held all 6 copies of the e-mail, and the recorded responses’ file all 5.

VACUUM freed the space without clearing it. It left 3 of the 6 copies in the trace table’s file and 2 of the 5 in the recorded responses’. It left a different share of each string: 5 of the 6 copies of the full name were still there. What plain VACUUM leaves is not something to build an erasure on.

VACUUM FULL rewrote the files. It brought the e-mail and the name to 0 in both tables, and the counts stayed at 0 afterwards. It is the first step at which the files are clean, which is why the erasure’s third step is a rewrite of the affected tables.

The write-ahead log kept the address. After VACUUM FULL it still held it. The address left the log only when unrelated writes overwrote its segments: 32 MB, written 16 MB at a time with a CHECKPOINT after each, with min_wal_size at 80 MB and 16 MB segments. The table files stayed at 0 throughout. The decision record expects a store taking traffic to cycle its log within the day, and I did not measure that. The log’s counts depend on where its segments fall, so the CI re-run asserts that there are some after the seed and none after the recycle, not the numbers.

The one-field trace in data-platform-architecture found the same log on the product’s own database: every erased address was still in its write-ahead log, on the primary and the replica, which no platform job reaches.

What erasure by identifier did not find

Erasure finds the forms of a name that the identity table holds: the e-mail address and the full name. The same person was also written three other ways in other users’ traces.

Mention written as Mentions Left after erasure
E-mail address or full name 6 0
Address spelled out with “at” and “dot” 1 1
First name alone 2 2
Surname alone 1 1

The check by e-mail and name said 0 and was right about what it checked. Every mention it matched was replaced, in the 2 other users’ rows that held them, and those rows were otherwise unchanged. The 4 it could not match were all still there.

I did not widen the pattern to first names and surnames. A first name alone is not an identifier, and a pattern that matches it rewrites rows that name someone else. The decision record accepts the residual instead, with the security and compliance lead as its owner: the 4 expire with their rows inside 30 days, so the exposure is bounded by the retention, not by the erasure. It names the point where that stops being enough. When a user asks for something the identity table does not hold, such as a nickname or a customer’s own customer, erasure by identifier needs a review step.

What the design needs

Control What it removes What it cannot remove
Retention window, 30 days Every trace and recorded response older than 30 days: 0 of 2,500 traces and 0 of 2,500 recorded responses left after one DELETE per table. The bytes, when the removal is a DELETE: they stay in the file and the log until a rewrite. Designed, not measured: with the store partitioned by day, retention drops whole partitions, which removes their files.
Erasure by identifier, e-mail and full name from the identity table The user’s own 12 traces and 12 recorded responses, and the 6 mentions in 2 other users’ rows, replaced with [erased]. 0 rows left holding the e-mail or name. A mention written another way: 4 of 4 survived. They expire with their rows.
Physical rewrite, VACUUM FULL on the tables the erasure touched Every copy in the table files: 6 to 0 in the trace table, 5 to 0 in the recorded responses. The write-ahead log, until 32 MB of unrelated writes recycle it. Backups, which are kept at most 7 days, with the erasure log re-applied after a restore. The model provider’s own retention, a contract setting that was not measured.

An erasure request is done within 7 days, in four steps: delete the user’s own traces and recorded responses; replace the user’s e-mail and name in other users’ records, because those records belong to someone else and support still needs them; rewrite the affected tables so that no copy of the deleted values is left in their files; write an audit row that holds no identifier. A rewrite of a large table holds an exclusive lock while it runs, so in production the store is partitioned by day and the erasure rewrites only the partitions it touched. That is designed, not measured: VACUUM FULL took 0.012 seconds here, on two tables of 2,488 rows each after the erasure, which says nothing about a large table.

The same drill scanned the evaluation set’s files for the seeded identities and for anything shaped like an e-mail address: 0 matches in 7 files. Evaluation questions taken from real conversations are rewritten without personal data before they enter the set, and provider settings forbid training on prompts, so the trace store is not the only place the duty is met.

The same duty in the warehouse

An erasure is done when the old copies are gone, not when the row is. Each store I measured keeps them somewhere different, and each ended in a different step.

Store Still there after the delete What ended it
A Delta table on Databricks All 100 of the user’s rows, by time travel REORG … APPLY (PURGE), then a VACUUM once the table’s retention had passed
The raw file in the data platform’s lab The deleted rows’ bytes, through delete, checkpoint and vacuum A rewrite of the file, 4.1 GB in 10 s
The Postgres trace store 6 copies in the trace table’s file VACUUM FULL, and 32 MB of writes for the log

Where the model keeps the identity decides what an erasure costs, and the trace store inherits that: the user’s key can sit in every trace row, and the e-mail should not.

Checks before a trace store goes live

  • Count the identifier in the files, not only in the rows. After a CHECKPOINT, search the table files, their TOAST files and the write-ahead log for the e-mail and the name, once after each step of the erasure job.
  • End the erasure with a rewrite. Rewrite the tables it touched, or drop whole day partitions, and prove it with the file count, not the row count.
  • Bound the copies you cannot rewrite. Set the retention and the backup age from the erasure commitment, and re-apply the erasure log after any restore.
  • Seed the proof with mentions written other ways. Score the erasure against a ground truth that includes a spelled-out address and a name alone, and publish how many it did not find.
  • Name an owner for what remains. Write the residual risk in the decision record, with the retention that bounds it.
  • Match the provider’s terms. The model provider’s retention and training terms must agree with the store’s. That is a contract setting.

Boundary. Synthetic traces from one seed, on Postgres 17.11 in a container. The committed run was re-run in CI on a fresh database, which asserts every figure except the timings, the log’s counts and the 32 MB it took to recycle it. The counts are occurrences of the e-mail and the name as text in Postgres’s own files and log. They say nothing about filesystem snapshots, replicas, backups or a managed service’s storage, and a managed Postgres was not tested. Partitioned retention, a store cycling its log within the day, and the cost of rewriting a large table are designed or expected, not measured. The decision record is 0013 in the repository.

Frequently asked questions

Does DELETE remove personal data from a Postgres table?

It removes the rows from queries, not the bytes from the file. In a test on Postgres 17.11, after DELETE and UPDATE had erased a user, no row held their e-mail, yet the trace table’s file still held all 6 copies of it and the recorded responses’ file all 5. A deleted row stays in the file until something cleans it up, and an updated row leaves its old version beside the new one.

Does VACUUM or VACUUM FULL erase deleted rows from disk?

Plain VACUUM frees the space without clearing it: it left 3 of the 6 copies of the e-mail and 5 of the 6 copies of the full name in the trace table’s file. VACUUM FULL rewrites the table into a new file, and brought both counts to 0 in both tables. It is the step an erasure needs, and it does not reach the write-ahead log or backups.

How long does a deleted e-mail stay in the Postgres write-ahead log?

Until unrelated writes overwrite its segments. After VACUUM FULL the log still held the address; it was gone after 32 MB of unrelated writes, written 16 MB at a time with a CHECKPOINT after each, with min_wal_size at 80 MB and 16 MB segments. The decision record expects a store taking traffic to do that within the day; that was not measured.

Does erasing a user from LLM traces remove every mention of them?

No. Erasure by e-mail and full name left 0 traces holding either, and missed all 4 mentions of the same user written another way: the address spelled out with “at” and “dot” (1), the first name alone (2) and the surname alone (1). Each expires with its row inside the 30-day retention, so the exposure is bounded by retention, not by erasure.

The drill and its results are in ai-platform-architecture, with the design in the case study. More on PostgreSQL and AI agents in production.

Basant Bhattarai is a data and AI architect with 9+ years in industry. He leads a team of five engineers and the architecture of data and AI platforms end to end: the data model, the databases underneath, governance and SOC 2 controls, and the AI built into them. He writes up what he measures, with the method beside each figure.

Currently: Senior Data Engineer at UXCam.

Building something similar? I'm open to long-term consulting, contract or full-time roles. Work with me