X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AD844D8894; Tue, 6 Sep 2005 21:22:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30825-02; Wed, 7 Sep 2005 00:22:31 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AD1AED8625; Tue, 6 Sep 2005 21:22:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j870MY2w022042; Tue, 6 Sep 2005 20:22:34 -0400 (EDT) To: adey11@gmail.com Cc: pgsql-admin@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: How to determine date / time of last postmaster restart In-reply-to: <1c66bda805090616596a199871@mail.gmail.com> References: <1c66bda805090616596a199871@mail.gmail.com> Comments: In-reply-to adey message dated "Wed, 07 Sep 2005 11:59:19 +1200" Date: Tue, 06 Sep 2005 20:22:34 -0400 Message-ID: <22041.1126052554@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/52 X-Sequence-Number: 18789 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