Tomas Vondra <tomas.von...@2ndquadrant.com> writes: > On 02/28/2018 02:39 PM, Grigory Smolkin wrote: >> It can be used to accurately calculate server uptime, since you can`t >> rely on pg_postmaster_start_time() in this.
> Can you please explain why pg_postmaster_start_time can't be used for > this purpose? It seems like a pretty good match, considering it's meant > to show server start time. It evidently depends on how you want to define "server uptime". If you get backend crashes often enough, you might feel a need to define it as "time since last crash". Although I would think that if that's happening regularly in a production environment, you have a problem you need to fix, not just measure. My own thought about that is that if you are trying to measure backend crashes, just knowing the time of the latest one is little help. You want to know how often they're happening. So this gets back to the question of why the postmaster log isn't a useful source of that information. I think that if we're to do anything in this area, improving the usefulness of the log would be more important than providing the proposed function. regards, tom lane