Re: AW: Very basic question about Archive logs

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: AW: Very basic question about Archive logs
Дата
Msg-id 8177cb9bc419f96f09302c50eb71d92723e01b9e.camel@cybertec.at
обсуждение исходный текст
Ответ на AW: Very basic question about Archive logs  ("Subramanian,Ramachandran" <ramachandran.subramanian@alte-leipziger.de>)
Ответы AW: AW: Very basic question about Archive logs
Список pgsql-novice
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



В списке pgsql-novice по дате отправления: