# Owned late-interaction storage and write amplification

The owned late-interaction certification gate records both correctness across a
PostgreSQL restart and the incremental storage/write cost of maintaining token
rows in the source DML transaction.

Run the reproducible PostgreSQL 17 workload from the repository root:

```sh
PG_VERSION=pg17 PG_FEATURE=pg17 \
DBNAME=pgcontext_late_interaction_owned \
tests/heavy/late_interaction_ann_serving.sh
```

The workload registers four two-dimensional source points, applies an update
and a logical point deletion, checkpoints and restarts PostgreSQL, verifies the
owned HNSW generation, repairs it, and confirms that repair does not reactivate
the deleted point. It then reports:

- logical point and token counts from the maintained registration counters;
- the sum of `pg_column_size()` for owned token rows in that collection;
- allocated bytes for the collection-scoped partial HNSW index; and
- WAL bytes generated by replacing one source row containing two tokens.

Reference result on 2026-07-21 (PostgreSQL 17.10, Apple arm64, development
build):

| Measurement | Result |
|---|---:|
| Indexed points | 4 |
| Token rows | 6 |
| Token-row bytes | 510 B |
| HNSW relation bytes | 24,576 B |
| Two-token source update WAL | 2,648 B |

These tiny-fixture numbers characterize fixed overhead and are not throughput
claims. The HNSW value is page-allocation dominated. The gate is valuable
because it makes changes to token-row shape, index allocation, or synchronous
write amplification visible alongside restart and exact-recheck correctness.

