Re: How to determine date / time of last postmaster restart

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: adey11(at)gmail(dot)com
Cc: pgsql-admin(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: How to determine date / time of last postmaster restart
Date: 2005-09-07 00:22:34
Message-ID: 22041.1126052554@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

adey <adey11(at)gmail(dot)com> writes:
> Please let me know if there is a way to determine when the Postmaster was
> last restarted?

The last postmaster start time, or the last database reset? These are
not the same if any backends have crashed since the postmaster started.
For determining stats lifespan I think you need the latter.

Offhand I think the file timestamp of $PGDATA/postmaster.opts would do
for the postmaster start time, and postmaster.pid for the other (I think
postmaster.pid is updated during a reset).

PG 8.1 will have a function to return postmaster start time, but not
database reset time. I wonder if this is misdefined --- if you are
trying to measure database uptime, the last reset would be more
appropriate to track.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Miguel Higuera 2005-09-07 05:03:49 Re: FW: Libpq - multibyte character support
Previous Message adey 2005-09-06 23:59:19 How to determine date / time of last postmaster restart

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2005-09-07 01:02:50 Re: uuid type for postgres
Previous Message adey 2005-09-06 23:59:19 How to determine date / time of last postmaster restart