Re: Last modification time

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: Last modification time
Дата
Msg-id 873biqt0aw.fsf@asmodeus.mcnaught.org
обсуждение исходный текст
Ответ на Last modification time  (Johan Vromans <jvromans@squirrel.nl>)
Ответы Re: Last modification time  (Johan Vromans <jvromans@squirrel.nl>)
Список pgsql-general
Johan Vromans <jvromans@squirrel.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Johan Vromans
Дата:
Сообщение: Last modification time
Следующее
От: "Karsten Hilbert"
Дата:
Сообщение: Re: Last modification time