For storing audit entries for auditing purposes, I've been wrestling with how to record what data has changed.
I've done two different ways in the past, but I'm creating a new system now and am trying to figure out which to use:
Have an AuditEntry and AuditEntryChange table. Each changed field value goes in the AuditEntryChange table and has a FK to AuditEntry.
Have the changed fields and values stored in XML in the AuditEntry table in a single field.
Which of the above would be more performant for saving and querying? (including the impact of serialization/deserialization if using XML). And which would take up less space?
Also, is best practice to use GUID or int PKs for audit tables? I can think of reasons for each.