Re: postgres uptime

From: "Larry Rosenman" <ler(at)lerctr(dot)org>
To: "'Marc G(dot) Fournier'" <scrappy(at)postgresql(dot)org>, "'Gavin Sherry'" <swm(at)linuxworld(dot)com(dot)au>
Cc: "'Alvaro Herrera'" <alvherre(at)dcc(dot)uchile(dot)cl>, "'Christopher Kings-Lynne'" <chriskl(at)familyhealth(dot)com(dot)au>, "'Gaetano Mendola'" <mendola(at)bigfoot(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgres uptime
Date: 2004-08-20 03:27:12
Message-ID: E1By03n-0002Ne-6I@lerami.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marc G. Fournier wrote:
> On Fri, 20 Aug 2004, Gavin Sherry wrote:
>
>>
>> On Thu, 19 Aug 2004, Alvaro Herrera wrote:
>>
>>> On Fri, Aug 20, 2004 at 09:43:13AM +0800, Christopher Kings-Lynne
>>> wrote:
>>>>> It seems that there is no way to know the postgres uptime, a sort
>>>>> of uptime() function could be usefull.
>>>>> I had recently the necessity of detect a node fail over, and the
>>>>> only way I can do it with a SQL connection is asking the engine
>>>>> uptime. Of course I can do it with PS but now that windows version
>>>>> is out I believe a platform indipendent way is required. Any
>>>>> objection to add it ?
>>>>
>>>> That sounds like a cool idea to me, although I would suggest a
>>>> function pg_uptime() that returns an interval or something.
>>>>
>>>> However, adding a new function requires a re-initdb, so it's quite
>>>> unlikely this will be in for 8.0.
>>>
>>> Is the uptime kept internally anywhere? Or even the start time?
>>
>> We do this at the start of ServerLoop():
>>
>> gettimeofday(&earlier, &tz);
>>
>> and that value isn't changed, AFAICT. However, I'm not sure why an
>> uptime is all that useful?
>
> Bragging rights? :)
>

If we ever do SNMP stuff, it will be useful for those packets as well.

LER

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-08-20 03:34:42 Re: postgres uptime
Previous Message Philip Warner 2004-08-20 03:26:39 Re: tablespace and sequences?