public inbox for pgsql-novice@postgresql.org
help / color / mirror / Atom feedFrom: Laurenz Albe <laurenz.albe@cybertec.at>
To: Subramanian,Ramachandran <ramachandran.subramanian@alte-leipziger.de>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-novice@lists.postgresql.org <pgsql-novice@lists.postgresql.org>
Subject: Re: AW: Very basic question about Archive logs
Date: Thu, 26 Mar 2026 14:00:36 +0100
Message-ID: <8177cb9bc419f96f09302c50eb71d92723e01b9e.camel@cybertec.at> (raw)
In-Reply-To: <5604c5c610e44a0d97daceaf5f1ae01f@alte-leipziger.de>
References: <dee8d2457c034cddb7ab7021e1caf3f7@alte-leipziger.de>
<CAKFQuwZwA=sq7xeLV032QJCzZ99NQnq8SNg4a6Y_hBxN_D=PmA@mail.gmail.com>
<5604c5c610e44a0d97daceaf5f1ae01f@alte-leipziger.de>
On Thu, 2026-03-26 at 12:38 +0000, Subramanian,Ramachandran wrote:
> Just a theoretical question to better my understanding. If I take a backup
> on Monday at 0100 Hours and never make any further Backups but hold on to
> all the Logs ( Active and Archive),
> I could theoretically go to any PIT between Monday 0100 Hours and NOW?
Yes. That is, if the backup *ended* at 1:00 a.m.
> If I apply the base backup from Monday 0100 , how does Postgres know which
> Archive Logs need to be applied from it’s current state to get to the PIT.
> Obviously when the basebackup was taken, the now needed logs did not exist.
> So this information cannot have been recorded during the backup.
PostgreSQL knows where to start, because that is in the backup_label file.
If recovery reaches the end of the current WAL segment, and we have not
yet reached the recovery target, PostgreSQL will restore the next WAL segment
and continue recovery (actually, PostgreSQL prefetches WAL segments, but that
doesn't affect the principle).
Every commit record in the WAL has the commit timestamp, and that is how
PostgreSQL can determine if it has reached the recovery target (if
recovery_target_time was used).
Yours,
Laurenz Albe
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-novice@postgresql.org
Cc: laurenz.albe@cybertec.at, ramachandran.subramanian@alte-leipziger.de, david.g.johnston@gmail.com, pgsql-novice@lists.postgresql.org
Subject: Re: AW: Very basic question about Archive logs
In-Reply-To: <8177cb9bc419f96f09302c50eb71d92723e01b9e.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox