Re: last insert/update for a table

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Kevin Kempter" <kevink(at)consistentstate(dot)com>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: last insert/update for a table
Date: 2010-01-21 17:03:57
Message-ID: 4B58349D020000250002E98E@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Kevin Kempter <kevink(at)consistentstate(dot)com> wrote:

> is there a system catalog query or function that will show me the
> last time an insert or update occurred for a specified table ?

That would be rather expensive to maintain. You could almost count
on looking at the timestamps on the underlying files, except that
various maintenance, like setting hint bits and vacuuming, would
cause changes there in addition to inserts and updates.

If this is some sort of audit because of suspected inappropriate
actions, be sure you capture a copy of the database ASAP. You might
be able to figure something useful based on the xmin and xmax values
for tuples. Without knowing exactly why you want this, it's hard to
offer specific advice.

-Kevin

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kevin Kempter 2010-01-22 05:14:39 query to list all user tables and related constraints
Previous Message Uwe Bartels 2010-01-21 07:52:25 vacuum + autovacuum