Re: Last modification time

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Johan Vromans <jvromans(at)squirrel(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Last modification time
Date: 2006-02-11 14:52:39
Message-ID: 873biqt0aw.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Johan Vromans <jvromans(at)squirrel(dot)nl> writes:

> Greetings,
>
> For a big application, I want to generate reports from the database and
> keep these on-line as long as they reflect the actual contents of the
> database. I only want to regenerate the reports when needed, i.e.,
> when the database contents have changed.
>
> I'm sure PostgreSQL can tell me when the last update has been
> COMMITted but until now I haven't been able to find out how. I must
> have used the wrong search terms...
>
> Can anyone tell me how to find the last update time of a database?

There isn't any out-of-the-box way that I know of.

I would put an AFTER trigger on all the tables concerned that inserts
a row into an audit table. Your report generator can then run
periodically, see if there are any new audit entries, generate
reports, and clean out the audit table (if desired).

Note that the audit table may grow very fast and need vacuuming a lot
if you clean it out.

Audit tables are useful for other things too, if you can afford them.

-Doug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2006-02-11 15:56:41 Re: Last modification time
Previous Message Johan Vromans 2006-02-11 14:39:24 Last modification time