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: pgsql-novice@lists.postgresql.org <pgsql-novice@lists.postgresql.org>
Subject: Re: how long should Archive logs be retained
Date: Thu, 27 Nov 2025 20:34:10 +0100
Message-ID: <d615d389a140169a5d338cf540a0c17ed3ec346e.camel@cybertec.at> (raw)
In-Reply-To: <329482d836f34a548d071aab63961f11@alte-leipziger.de>
References: <a02ba9c8a1c046d292766096eecd2631@alte-leipziger.de>
<1f12660d233efc644edb6a23c7bd4bcc84b503af.camel@cybertec.at>
<329482d836f34a548d071aab63961f11@alte-leipziger.de>
On Thu, 2025-11-27 at 15:49 +0000, Subramanian,Ramachandran wrote:
> Archive logging is NOT enabled and a transaction keeps filling up the logs one by one
> till all the logs are full WITHOUT Any COMMIT. Then what happens? Does Postgres hang
> or does Postgres terminate this thread ?
Neither.
As I said, PostgreSQL will happily remove WAL segments that contain uncommitted
transactions. PostgreSQL will never undo any work. If a transaction is rolled back,
all the uncommitted data are still there, they are only invisible.
Later, the autovacuum daemon (a kind of garbage collection) will remove these data,
but that's a separate activity (that is again logged to WAL).
> After reading your answers, I understand that Archive logs are needed ONLY if we want
> to go back in time to a past point of consistency ( example Current date minus 5 days ) .
No, archive logs are needed whenever you you need to go back in time at all.
With the WAL in pg_wal, all you can do is recover after a crash, which will recover
all committed transactions.
> Ofcourse a begining backup is needed on this day as well ( a backup taken on current
> day - 5 days ) . Then using the backup and the Logs that were archived on this day ,
> we can rollforward to a Point in time on this day. 1. Did I understand correctly ? 2.
> Is there any other scenareo where Archive logs will be used?
I am not sure I can follow.
You need a WAL archive whenever you want to undo *anything*. For that, you have to
restore a base backup that *finished* before the point in time that you want to
recover to. Also, you need all WAL from the start of the base backup until the point
in time to which you want to recover.
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, pgsql-novice@lists.postgresql.org
Subject: Re: how long should Archive logs be retained
In-Reply-To: <d615d389a140169a5d338cf540a0c17ed3ec346e.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