[Tfug] RDBMS audit trails?
Claude Rubinson
rubinson at u.arizona.edu
Thu Jul 31 13:42:43 MST 2008
On Thu, Jul 31, 2008 at 11:53:04AM -0700, Bexley Hall wrote:
> > > > > I'm just looking for entries like:
> > > > >
> > > > > record #, who, when
> > > >
> > > > It's trivial to set up triggers to do such a
> > thing but
> > > > by doing so you're doubling your number of
> > transactions.
> > >
> > > Yes. But, I figure I could treat the "log"
> > table as a
> > > FIFO and limit its size in the trigger code. I had
> > > assumed something like this would be something that
> > > users would *want* -- even if only for testing
> > > purposes -- hence the question.
> >
> > Limiting the size of a table isn't a problem. Just
> > include a datetime
> > stamp and add an INSERT/UPDATE trigger that conditionally
> > deletes the
> > oldest records.
>
> I figured on being even cruder -- just delete the "first"
> record after adding the "last" record. (i.e., initialize
> the table with N empty records -- where N is the depth
> of the FIFO you want to preserve)
Uh-uh. Remember - relational database tables are unordered. There is
no "first" or "last" record. You could do an autonumber field but
those are proprietary and can be wonky. If you're going to do this
(which, again, I think is a very problematic application of NIH), use
datetime.
C.
More information about the tfug
mailing list