SQL - Audit log table design - Which would you prefer?

Id Description Created TaskId TaskType That aside, your AuditLog table definitely should have a TaskType field, as otherwise it becomes relatively difficult to work out what type of change a record in the log represents Also, I would avoid (where possible) denormalizing your tables (i.e. Having columns that will always be null for a given task type) unless absolutely necessary (for performance reasons for example). Instead I'd recommend using tables and joins for the task specific columns: Table ExampleTaskAuditLog ------------------------------ AuditId (PK) TaskSpecificField AnotherTaskSpecificField.

Id Description Created TaskId TaskType That aside, your AuditLog table definitely should have a TaskType field, as otherwise it becomes relatively difficult to work out what type of change a record in the log represents. Also, I would avoid (where possible) denormalizing your tables (i.e. Having columns that will always be null for a given task type) unless absolutely necessary (for performance reasons for example).

Instead I'd recommend using tables and joins for the task specific columns: Table ExampleTaskAuditLog ------------------------------ AuditId (PK) TaskSpecificField AnotherTaskSpecificField.

Assuming you are logging events/tasks/actions, and not modifications to individual tables, I'd go with the first, for the same reasons @Kragen says (upvoted). But if you're auditing changes to incividual tables, I'd go with one audit table for each table being audited. A side-question, do you really want those foreign keys?

If an item (row) in a table is deleted, you would then have to delete the audit trail for that item. Do you only need audit logs for existing items? ("Audit" generally implies "watch what they're up to", and if "they" can wipe out all trace of their activities that's generally frowned upon, even on Wall Street.).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions