473,375 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,375 software developers and data experts.

point-in-time vs. shadow tables for audit history

Dear Experts,

We need to design a database which has an audit trail for updates to a
certain set of tables. The two main approaches I've seen for this
include shadow tables (an extra table to track changes to the main
table) and point-in-time architectures (having an "event date" and an
"as known" date for every row). Can someone suggest the pros and cons
of each approach or point me to relevant literature discussing the
best approach?

To provide an example of what we are aiming for, imagine we have a
single table with date, value pairs, e.g., [(1/1/2000, 5.2),
(1/1/2001, 5.3), etc.]. Sometimes we may need to go back and correct
old values, e.g., on 1/1/2008 we may realize that the value on
1/1/2001 really was 4.2 not 5.3. The main use case is we want to get a
time series of most up-to-date date/value pairs. A secondary use case
is getting a time series of what we thought at a certain point in the
past. The shadow table approach would have an extra table to track all
changes while the point-in-time approach would an an event_date and
as_known_date column to the original table.

Thanks,
-Emin
Oct 31 '08 #1
4 8098
Emin (em**********@gmail.com) writes:
We need to design a database which has an audit trail for updates to a
certain set of tables. The two main approaches I've seen for this
include shadow tables (an extra table to track changes to the main
table) and point-in-time architectures (having an "event date" and an
"as known" date for every row). Can someone suggest the pros and cons
of each approach or point me to relevant literature discussing the
best approach?
If all you have a column within the table, all you can track is the most
recent change, which is a fairly lightweight audit, and certainly not a
trail.

As for shadow tables, there are different ways to go. You can indeed
have a shadow table which is more or less a copy of the original, but
you could also have a generic table that has the keys (tablename,
keyvalue1, keyvalue2, ...), the data about who and when from what,
and then two XML columns that holds the before and afterimages of
the data. This information is more difficult to query, and not to
recommend if you need to retrieve the historic situation outside audit
trail. On the flip side, it's easy to write a generic function that
displays the changes for a given entity.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Oct 31 '08 #2
Here is one article discussing different design options for auditing:
http://www.mssqltips.com/tip.asp?tip=1468

On SQL Server 2008 Change Data Capture (CDC) provides a convenient
mechanism to implement data auditing:
http://www.sql-server-performance.co...apture_p1.aspx

Also, CDC implements DDL auditing as well:
http://www.sql-server-performance.co...apture_p1.aspx

--
Plamen Ratchev
http://www.SQLStudio.com
Nov 1 '08 #3
Plamen Ratchev (Pl****@SQLStudio.com) writes:
On SQL Server 2008 Change Data Capture (CDC) provides a convenient
mechanism to implement data auditing:
http://www.sql-server-performance.co...apture_p1.aspx

Also, CDC implements DDL auditing as well:
http://www.sql-server-performance.co...apture_p1.aspx
But keep in mind that CDC is primarily designed and intended for different
purposes than auditing.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Nov 1 '08 #4
> Can someone suggest the pros and cons of each approach or point me to relevant literature discussing the best approach? <<

Google up a series of articles by Tom Johnston in RM REVIEW.

My other advice is to buy a third party tool that has some legal
standing and NOT write your own.

Nov 1 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Zach | last post by:
Hello, I have recently been reviewing the Calyx Point mortgage software and had some quesitons I was hoping someone could help me with. 1) Are there ways to input data into Point via a web...
0
by: Jerry Asher | last post by:
I have a table of points, actually zip codes and their points. If a point is an X, Y pair, how do I extract X from a point? (And how do I create or insert a new point (X, Y)?) I am given a...
3
by: Martin Hart | last post by:
Hi all, PG 7.4 beta4 (not had a chance to upgrade yet :-( how do i cast something of type point to text? db=# select '(1,2)'::point::text; ERROR: cannot cast type point to text db=#...
24
by: j0mbolar | last post by:
C supports single precision floating point and double precision floating point but does it support fixed floating point? i've read that fixed floating point is more accurate than single precision...
21
by: Allin Cottrell | last post by:
OK, I realize that what I am asking here is not likely to have a answer within the C standard. Nonetheless, it is not specific to any particular platform, so I'll hazard the question anyway. A...
0
by: pallav | last post by:
is anyone aware of a freely-available C fixed point library for unix/linux systems? i remember about 6-7 months ago, i searched the net and located a project (i'm not sure now if it was open...
3
by: Action | last post by:
Point is a struct but I can do both Point a; Write(a.X); Write(a.Y); and Point a = new Point(1,1); Write(a.X);
2
by: jerry chapman | last post by:
I have created an Array of Point Arrays. Point myPolygons; myPolygons=new Point; What is the syntax for entering the 30 points into myPolygons?
5
by: pcnerd | last post by:
I want to create a program that will do graphics like math functions & fractals & stuff. I've been browsing thru books at the bookstores. Apparently, the Point object replaced Pset. The books...
3
by: roche72 | last post by:
Help. I have a simple floating point calculation and depending on what thread it gets executed on, I get a different result. Here are the pieces of code: class OmniCamera { private float...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.