If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Simple audit fields

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-08, 11:12
brlav35 brlav35 is offline
Registered User
 
Join Date: Jul 2008
Location: Québec City, Canada
Posts: 10
Simple audit fields

Hello everybody,

I am designing a database schema, and I was wondering about adding a couple of primitive audit fields to each table.

These ones are:
- ADDED_BY
- DATE_ADDED
- MODIFIED_BY
- DATE_MODIFIED

I feel that these one can be useful in some cases for simple checkups, but I think that will overload (a bit) my model. Another fact is that with these column, we can't know who modified and when between the added and last modification.

Any advice, experience or recommendation about this approach?

Thanks
Bruno
Reply With Quote
  #2 (permalink)  
Old 12-02-08, 12:18
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
It's a common approach - we do exactly that on my project for all tables. On a small number of tables, where auditing is more critical, we have triggers that write to a log table so that the full history of inserts, updates and deletes is kept. But for most tables, knowing who added the row and who last updated it is good enough 9 times out of 10.

The overhead of having these columns is minimal. They do distract from the "real" data on logical data models though, so my preference would be to leave them off ERDs.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 12-02-08, 12:19
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
I avoid the "Added" columns, as I have found that sort of data to be unreliable and of little value. I have scripts that will do more complete auditing, if that is really necessary.

In the meantime, here is a script for adding "Modified" and "Modifier" columns and triggers.
Attached Files
File Type: txt AutoAuditor.txt (6.1 KB, 165 views)
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On