pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to determine date / time of last postmaster restart
8+ messages / 6 participants
[nested] [flat]

* How to determine date / time of last postmaster restart
@ 2005-09-06 23:59  adey <adey11@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread

From: adey @ 2005-09-06 23:59 UTC (permalink / raw)
  To: pgsql-admin

Please let me know if there is a way to determine when the Postmaster was 
last restarted?
This is for tuning. I have stats_reset_on_server_start turned on, but I 
don't know when last the Postmaster was started, so I can't determine the 
period my current system stats cover.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: How to determine date / time of last postmaster restart
@ 2005-09-07 00:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: adey <adey11@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Tom Lane @ 2005-09-07 00:22 UTC (permalink / raw)
  To: adey11@gmail.com; +Cc: pgsql-admin; pgsql-hackers@postgresql.org

adey <adey11@gmail.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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [HACKERS] How to determine date / time of last postmaster restart
@ 2005-09-07 05:38  Jim C. Nasby <jnasby@pervasive.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Jim C. Nasby @ 2005-09-07 05:38 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: adey11@gmail.com; pgsql-admin; pgsql-hackers@postgresql.org

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: How to determine date / time of last postmaster restart
@ 2005-09-07 18:01  Peter Eisentraut <peter_e@gmx.net>
  parent: adey <adey11@gmail.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Peter Eisentraut @ 2005-09-07 18:01 UTC (permalink / raw)
  To: adey11@gmail.com; +Cc: pgsql-admin

adey wrote:
> Please let me know if there is a way to determine when the Postmaster
> was last restarted?

If you have configured your server log to contain timestamps, that is 
your best bet to look.  In any case, the server log will tell when the 
last shutdown was, so you can at least narrow down the time frame.  You 
can also use pg_controldata to check the time of last change to 
pg_control (which is changed when the server starts).

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [HACKERS] How to determine date / time of last postmaster restart
@ 2005-09-07 19:29  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Jim C. Nasby <jnasby@pervasive.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Alvaro Herrera @ 2005-09-07 19:29 UTC (permalink / raw)
  To: Jim C. Nasby <jnasby@pervasive.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; adey11@gmail.com; pgsql-admin; pgsql-hackers@postgresql.org

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"



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [HACKERS] How to determine date / time of last postmaster restart
@ 2005-09-08 01:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  1 sibling, 1 reply; 8+ messages in thread

From: Tom Lane @ 2005-09-08 01:22 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Jim C. Nasby <jnasby@pervasive.com>; adey11@gmail.com; pgsql-admin; pgsql-hackers@postgresql.org

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 ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [HACKERS] How to determine date / time of last postmaster restart
@ 2005-09-08 17:18  Jim C. Nasby <jnasby@pervasive.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: Jim C. Nasby @ 2005-09-08 17:18 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; adey11@gmail.com; pgsql-admin; pgsql-hackers@postgresql.org

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [HACKERS] How to determine date / time of last postmaster
@ 2005-09-23 03:05  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  1 sibling, 0 replies; 8+ messages in thread

From: Bruce Momjian @ 2005-09-23 03:05 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Jim C. Nasby <jnasby@pervasive.com>; Tom Lane <tgl@sss.pgh.pa.us>; adey11@gmail.com; pgsql-admin; pgsql-hackers@postgresql.org

Alvaro Herrera wrote:
> 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 ...

Added to TODO:

	* Add function to report the time of the most recent server
	  reload

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2005-09-23 03:05 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-06 23:59 How to determine date / time of last postmaster restart adey <adey11@gmail.com>
2005-09-07 00:22 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-09-07 05:38   ` Jim C. Nasby <jnasby@pervasive.com>
2005-09-07 19:29     ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2005-09-08 01:22       ` Tom Lane <tgl@sss.pgh.pa.us>
2005-09-08 17:18         ` Jim C. Nasby <jnasby@pervasive.com>
2005-09-23 03:05       ` Re: [HACKERS] How to determine date / time of last postmaster Bruce Momjian <pgman@candle.pha.pa.us>
2005-09-07 18:01 ` Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox