Re: uptime() for postmaster

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthias Schmidt <schmidtm(at)mock-software(dot)de>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: uptime() for postmaster
Date: 2004-12-31 19:18:33
Message-ID: 11438.1104520713@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

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

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

> d) Can I piggy-back on 'BackendParameters' to get postmasters
> start-time to the backends?

AFAICS you have no other choice.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-12-31 19:24:32 contrib regression on old versions
Previous Message Michael Wildpaner 2004-12-31 18:04:31 'COPY ... FROM' inserts to btree, blocks on buffer writeout