SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Audit approach for performance tunning


Audit approach for performance tunning

Author
Message
Megha P
Megha P
SSChasing Mays
SSChasing Mays (652 reputation)SSChasing Mays (652 reputation)SSChasing Mays (652 reputation)SSChasing Mays (652 reputation)SSChasing Mays (652 reputation)SSChasing Mays (652 reputation)SSChasing Mays (652 reputation)SSChasing Mays (652 reputation)

Group: General Forum Members
Points: 652 Visits: 2501
we do have requirement of tracking insert,update and delete action of tables with tracking userid.
two approach is there.

1) creating single table with below fields:
LogID int
TableName int
Action tinyint (1= Insert,2=Update,3=Delete)
RecordID int
UserID int
CreatedDate DateTime(Default will be current date)

2) Add below fields in all the tables:
modifieddate datetime
modifiedUser int
transactionType Char(1) --this will have action like 'I','D' or 'U' for insert update and delete

which approach will be good for performance ?
LutzM
LutzM
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24949 Visits: 13559
The second approach would require to replace the DELETE functionality with a solution that would add a DELETE flag. Otherwise you wouldn't have a row to add the modified* information ;-)

Maybe this link can help you to decide what solution would be the best for your scenario.



Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
GilaMonster
GilaMonster
SSC Guru
SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)SSC Guru (237K reputation)

Group: General Forum Members
Points: 237579 Visits: 46378
It's not about performance, it's about what meets your requirements.

Option 2 will only show the last user who changed the row and won't show what they changed. If you need to see all the users who modified the row, then option 2 won't suffice.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


azmiman
azmiman
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 8
GilaMonster (4/21/2014)
It's not about performance, it's about what meets your requirements.

Option 2 will only show the last user who changed the row and won't show what they changed. If you need to see all the users who modified the row, then option 2 won't suffice.


Is there any online resource that I can read on how to audit/track who change what value in a record? My audit requirement:
if some one changed a value / values in a record, I need to know who edit the record and which attribute(s) value has been changed (if possible, i need to know what was the original value)..

Thanks!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search