Proposal: Add backup start time to pg_stat_progress_basebackup

Поиск
Список
Период
Сортировка
Искать

Proposal: Add backup start time to pg_stat_progress_basebackup

От:
Rob Moore <robmoore121@gmail.com>
Дата:
Hi all,

We're currently working on upgrading our application from using pg14 to pg18. We've managing the database ourselves, and that includes backups. We were previously using exclusive backups, but are changing that to use pg_basebackup instead. We had a health check that reported on in-progress backups using pg_backup_start_time(), but of course since that's gone, I wanted a replacement for base backups. Reading around, the natural home for that information would appear to be pg_stat_progress_basebackup, but it isn't one of the columns of that view.

Was backup start time intentionally omitted from pg_stat_progress_basebackup, or would it be okay for me or someone else to add it as a column? Or, am I being daft and there is another obvious way to get the start time for an in-progress base backup?

(I would have no idea where to start, but I'm enthusiastic about having a go, and on the face of it this seems like it might be a fairly accessible task for a first-time contributor)

Thanks,
Rob

Re: Proposal: Add backup start time to pg_stat_progress_basebackup

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Monday, January 19, 2026, Rob Moore <robmoore121@gmail.com> wrote:

Was backup start time intentionally omitted from pg_stat_progress_basebackup, or would it be okay for me or someone else to add it as a column? Or, am I being daft and there is another obvious way to get the start time for an in-progress base backup?


Not sure about base backup but the other progress reporting commands would get that info from pg_stat_activity.query_start which can be joined to using pid.  backend_start is likely close enough for pg_basebackup if it doesn’t recognize the replication protocol as a “command”.  I haven’t checked.

David J.

 

Re: Proposal: Add backup start time to pg_stat_progress_basebackup

От:
Rob Moore <robmoore121@gmail.com>
Дата:
Thanks David, I've just tried this, and joining to pg_stat_activity on pid works great. I'll do that.

Sorry for the noise 😅,
Rob

On Tue, Jan 20, 2026 at 11:22 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Monday, January 19, 2026, Rob Moore <robmoore121@gmail.com> wrote:

Was backup start time intentionally omitted from pg_stat_progress_basebackup, or would it be okay for me or someone else to add it as a column? Or, am I being daft and there is another obvious way to get the start time for an in-progress base backup?


Not sure about base backup but the other progress reporting commands would get that info from pg_stat_activity.query_start which can be joined to using pid.  backend_start is likely close enough for pg_basebackup if it doesn’t recognize the replication protocol as a “command”.  I haven’t checked.

David J.

 
FAQ