Re: Add pg_accept_connections_start_time() for better uptime calculation - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Add pg_accept_connections_start_time() for better uptime calculation
Date
Msg-id 0661ae3e-0796-4690-a2e6-6ead4347714b@oss.nttdata.com
Whole thread Raw
List pgsql-hackers

On 2025/02/16 16:05, Robins Tharakan wrote:
> Hi,
> 
> This patch introduces a new function pg_accept_connections_start_time().
> 
> Currently, pg_postmaster_start_time() is used to determine when the
> database started. However, this is not accurate since the postmaster
> process can sometimes be up whereas the database is not accepting
> connections (for e.g. during child process crash [1],
> long crash-recovery etc.)
> 
> This can lead to inaccurate database uptime calculations.
> 
> The new function, pg_accept_connections_start_time(), returns the
> time when the database became ready to accept connections.

Shouldn't this function also handle the time when the postmaster
starts accepting read-only connections? With the patch, it doesn’t
seem to cover that case, and it looks like an unexpected timestamp
is returned when run on a standby server. Maybe the function should
return a record with two columns — one for when the postmaster
starts accepting read-only connections and another for normal
connections?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION




pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Next commitfest app release is planned for March 18th
Next
From: Peter Eisentraut
Date:
Subject: Re: Cannot find a working 64-bit integer type on Illumos