473,569 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8131
Emin (em**********@g mail.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****@sommarsk og.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****@SQLStud io.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****@sommarsk og.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
3471
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 site using technologies other than the Calyx Point WebCaster software. I would preferably like to use .NET here to communicate with the Point system if...
0
1501
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 latitude, longitude pair and I would like to determine the closest zipcode. I can do this using point_distance, but I wonder if there is a faster...
3
1973
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=# select text('(1,2)'::point); ERROR: function text(point) does not exist
24
2215
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 floating point when dealing with dollars and cents.
21
4192
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 C double can be aliased by an array of unsigned char, to which any desired byte pattern may be written. Is there any somewhat portable way of...
0
1614
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 source or not) that was developing a Q.16 fixed-point library. i'm searching today and can't locate this project or the source code. if anyone has...
3
3800
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
6180
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
2004
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 explain how to create a Point object, but not how to use it. I want to be able to plot individual pixels. I tried DrawEllipse, but that just draws...
3
1609
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 m_PixelSize; private float m_ImageHeight;
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.