Re: uptime() for postmaster

From: Matthias Schmidt <schmidtm(at)mock-software(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: uptime() for postmaster
Date: 2005-01-03 17:34:06
Message-ID: AB190842-5DAD-11D9-BCF6-000393AA75A0@mock-software.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

Am 31.12.2004 um 20:18 schrieb Tom Lane:

> Matthias Schmidt <schmidtm(at)mock-software(dot)de> writes:
>> a) is the name uptime() OK?
>
> Probably should use pg_uptime(), or something else starting with pg_.

What about 'pg_starttime()' since it is not a period but a
point-in-time?

>
>> b) is the return-type 'Interval' OK?
>
> It might be better to return the actual postmaster start time (as
> timestamptz) and let the user do whatever arithmetic he wants.
> With an interval, there's immediately a question of interpretation
> --- what current timestamp did you use in the computation?
> I'm not dead set on this, but it feels cleaner.

you're right. Let's go for timestamptz and let the users decide ...
>
>> c) does it make sense (... fit in the scheme?) to place the code here:
>> src/backend/utils/misc/uptime.c
>
> No. This sort of stuff should go into utils/adt/. I'd be inclined to
> drop the function into one of the existing timestamp-related files
> rather than make a whole new file just for it. Someplace near the
> now() function would make sense, for instance.

yep - so the stuff goes to: utils/adt/timestamp.c, where now() and many
other time-related functions are.

>
>> d) Can I piggy-back on 'BackendParameters' to get postmasters
>> start-time to the backends?
>
> AFAICS you have no other choice.
>
> regards, tom lane
>
>

cheers,

Matthias

----------------------------------------------------------------------
Matthias Schmidt
Viehtriftstr. 49

67346 Speyer

Tel.: +49 6232 4867
Fax.: +49 6232 640089

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-01-03 17:36:19 Re: PostgreSQL 8.0.0 Release Candidate 3
Previous Message Tom Lane 2005-01-03 17:14:17 Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout