Quantcast
Channel: Active questions tagged audit - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 147

Developing SQL Server DML Audit Trail for Heavily Denormalized Staging Table?

$
0
0

Put simply, we (are forced to) rely upon a very large, heavily denormalized staging table that's typically about 20k records, 80+ fields that's overwritten at least 4-5x each business day for updates, data refreshes in reporting, etc.

Now, I've been tasked with deriving audit histories and track changes of each row in the table, so we know who last modified a record, when and exactly what was updated. The tracked changes are really only possible with manual data exports into the Staging table, however, so nothing is fully automated. So, multiple changes could be made between exports into the Staging table and the audit history may capture multiple saved changes from one export.

My thought was to remove the truncate logic and instead just append each export into the staging table with export time stamps, etc...however with at least 5 daily updates each business day, this would be 2M+ rows each week, leading to at least 25M rows a year. Still not too much data, but it's enough to consider a more efficient approach, especially to write more efficient queries, reads, etc.

Since the data is so heavily denormalized though, I'm not exactly sure how to approach developing a SQL function (SP, trigger, view, etc) that might provide the insights I need.

Any ideas?


Viewing all articles
Browse latest Browse all 147

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>