Data Engineering
Why Append-Only Audit Logs Matter in Data Governance
The case for immutable audit trails and how to implement them in PostgreSQL without sacrificing performance.
By Ijlal Ansari
In any regulated industry, the question isn't whether you need audit logs — it's whether your audit logs can be trusted. Mutable logs are essentially worthless for compliance because they can be retroactively altered.
Append-only tables in PostgreSQL use a simple but powerful pattern: no UPDATE or DELETE permissions on the audit table, with all writes going through a dedicated INSERT-only function.
The performance concern is real but manageable. By partitioning the audit table by month and using BRIN indexes on the timestamp column, we maintain sub-millisecond insert times even at scale.
In the implementation, every change generates an immutable audit trail so that the data story remains clear and reviewable over time.