Re: Discovering time of last database write

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Discovering time of last database write
Дата
Msg-id 1168273163.20602.5.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Re: Discovering time of last database write  ("Andy Dale" <andy.dale@gmail.com>)
Список pgsql-general
On Mon, 2007-01-08 at 02:22, Andy Dale wrote:
> Hi,
>
> Sorry for the slight delay in my response.
>
> I am using 3 PostgreSQL databases and writing to them using an SQL
> proxy.  These databases have a high write volume.  On rebooting all 3
> servers for OS/Software updates, i would like to figure out which was
> the last written to DB (this is assuming the DB/Servers are not all
> taken down at the same time), the times are kept in sync with NTP.
>
> I imagine it is possible to get this behaviour with after triggers,
> but this means i have to attach the same trigger to each table ??

Hmmmm.   Still not completely clear on what exactly you're doing, but I
think I am getting an idea.

You could set each table to have a field for a timestamp, and build a
simple rule / trigger that updates it with the current time stamp for
every row as it's inserted / updated.  Then you could select
max(timestampcolumn) from a table to see which db had the latest
version.

I still think there might be a better solution to your problem.  Can we
get a more generic overview of what you're trying to do.  The 10,000
foot high view, so to speak.

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: doubts
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Discovering time of last database write