Gaetano Mendola <mendola@bigfoot.com> writes:
>> I think we should just call gettimeofday() at postmaster start and store
>> it somewhere.
> Isn't the shared memory a good place ?
Depends. Do you want to reset it during a backend-crash-recovery cycle?
You'll have to, if it's only stored in shared memory. Depending on what
your definition of "uptime" is, that could be a reasonable thing to do,
or not.
There's been a remarkable lack of discussion about exactly what this
number would mean, anyway. Does "postmaster start" mean postmaster
process start? Or when we are first ready to receive a connection?
There could be a *very* large difference, in the case of a hot-standby
postmaster.
regards, tom lane