adey 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

Search Discussions

  • Jim C. Nasby at Sep 7, 2005 at 5:38 am

    On Tue, Sep 06, 2005 at 08:22:34PM -0400, Tom Lane wrote:
    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.
    Is it too late to add a function that returns last reset time as well?
    That would cover all bases and force some less confusing naming.
    --
    Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
    Pervasive Software http://pervasive.com work: 512-231-6117
    vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
  • Alvaro Herrera at Sep 7, 2005 at 7:29 pm

    On Wed, Sep 07, 2005 at 12:38:44AM -0500, Jim C. Nasby wrote:
    On Tue, Sep 06, 2005 at 08:22:34PM -0400, Tom Lane wrote:
    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.
    Is it too late to add a function that returns last reset time as well?
    That would cover all bases and force some less confusing naming.
    This would be one more vote in favour of initdb before next beta.
    (pltemplate being the other one.) We should set a threshold in order to
    be able to decide ...

    --
    Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com
    "Use it up, wear it out, make it do, or do without"
  • Tom Lane at Sep 8, 2005 at 1:23 am

    Alvaro Herrera writes:
    On Wed, Sep 07, 2005 at 12:38:44AM -0500, Jim C. Nasby wrote:
    Is it too late to add a function that returns last reset time as well?
    That would cover all bases and force some less confusing naming.
    This would be one more vote in favour of initdb before next beta.
    (pltemplate being the other one.) We should set a threshold in order to
    be able to decide ...
    It looks like we'll be initdb'ing to add pltemplate, so if someone wants
    to submit a proposed patch for this ...

    regards, tom lane
  • Jim C. Nasby at Sep 8, 2005 at 5:18 pm

    On Wed, Sep 07, 2005 at 09:22:55PM -0400, Tom Lane wrote:
    Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
    On Wed, Sep 07, 2005 at 12:38:44AM -0500, Jim C. Nasby wrote:
    Is it too late to add a function that returns last reset time as well?
    That would cover all bases and force some less confusing naming.
    This would be one more vote in favour of initdb before next beta.
    (pltemplate being the other one.) We should set a threshold in order to
    be able to decide ...
    It looks like we'll be initdb'ing to add pltemplate, so if someone wants
    to submit a proposed patch for this ...
    I might be able to do some of it; where would I need to capture reload
    time?

    Also, I'm thinking of leaving pg_postmaster_start_time as-is and adding
    pg_postmaster_reload_time. Thoughts?

    For reference, here's the original commit:
    http://archives.postgresql.org/pgsql-committers/2005-06/msg00181.php
    --
    Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
    Pervasive Software http://pervasive.com work: 512-231-6117
    vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedSep 7, '05 at 12:22a
activeSep 8, '05 at 5:18p
posts5
users3
websitepostgresql.org...
irc#postgresql

People

Translate

site design / logo © 2021 Grokbase