Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vOhky-0027ws-0j for pgsql-novice@arkaria.postgresql.org; Thu, 27 Nov 2025 19:34:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vOhkv-00854P-0p for pgsql-novice@arkaria.postgresql.org; Thu, 27 Nov 2025 19:34:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vOhku-00854F-37 for pgsql-novice@lists.postgresql.org; Thu, 27 Nov 2025 19:34:17 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vOhks-001q4o-38 for pgsql-novice@lists.postgresql.org; Thu, 27 Nov 2025 19:34:16 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-6418b55f86dso2158575a12.1 for ; Thu, 27 Nov 2025 11:34:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1764272052; x=1764876852; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=0zlfg7t9Vto6vV4c6dtWPV+9IupBb06g/QsxoqXm5yw=; b=n1xDF6F1vsUKYnnSPWBS0HokFjCTpP0koXh79rUXAmkp/rmQB8vpslFcyPue3l03Cz GDmTrrZmSuvqB/RwtcxNHGpVGWrFfNYdD9SPYEyDj/MOBFK0wEYFRFOIT0W2VVm518Wq aliIfMrpFsxu1kLUJB1mY19kEShvNeaxylnGvGl6lj1nbf6MfS5xamLAgT4JIH5VNcBG dQxT8Qa2HODooQQhEfRPrEY6FjPBlp2NNfWwzgEJdA+bambwEEqJyT1Uo3h1cUJqWi8Z z15wF8hRtz+7Gk5swEnBLMfYgnwrtlkevLCUdfARlvzz1KinbPZIWY0y8ghYuN/R+vaE gXmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764272052; x=1764876852; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0zlfg7t9Vto6vV4c6dtWPV+9IupBb06g/QsxoqXm5yw=; b=f28x4APFirwzo+2imbg6U3aLhBRKJGAffYegN6E/oC9/9ksOcb/k9teH2xDL407I4h 3E2RIAfHM/Nht+uXmVdSQ0XAxVh5Pyl8sHkdMfgICNEzWuZlNjaeKWSnsk0E9D+pz9qI E2QQe6iNyWI0m5hN5Ao36mityK2grOLLVa3ZTx4GWutDw1L1190nU3MUGmlqyOSiLbAw XnJ8gKT03uTnAokgk2L8hVgQlP5fxSOzgCMtn1slgzebgzRVP2tcGa27vibsGh9wrCTm h1YzONjW8xBpetxcIi88EScmGKmWzMaZH8eUjePFKWsvaU1cB6SB5SIZBseNNoZU1hUQ E9lQ== X-Forwarded-Encrypted: i=1; AJvYcCWxW8ZPP/ZhQOop4yF9mq69sqevBOOYZGjcSek52Z0OSD5RUTuIf1MQ8ezKKXU6fRzjWkt6iXBy9+HZF1w=@lists.postgresql.org X-Gm-Message-State: AOJu0YzOeCLUosydLbtyGWo1VfkyvxVo1k1Rx5vLC3sb6/ucp0u3Bluy 8W8ZNcUErnkJ2SLFX5sCmDPDKnWJD1VnwLIudGkZzoBs+w9jC+iMGJNQHJuLY8N1rFuoz7nk7Ho bW5mJP7A= X-Gm-Gg: ASbGnctEkbmNMYeJ61xK1rQ1ddYvf11qKX4C6FSDAT02y0cUh3KbWJPJbIo62au2Io8 PH18JsMJ6Pfann9NgyhBFshHaOJP4lES24cpiI8I1D7SR9RIhrq5ZiYn08mSxtGF0fXW0ULqlfw LEDmLbIa6rYQLSA5F6Y32rr4NJ+Y5eGV838w3IxwmMcuMk8q1M9xMRKu7oTNd91QUnK89hv/4Ap hLzL9HRRpJ+n82eBXcvuzZ1BiQrvF+q06RWydp8RXUf1/sKDwmz2PwzWtQ1X90GiU9wmva8B4KA zGbu6YG/uZ1IGoP+j2NKIrmGHnTcSbleNdg+KFzXMM/LNosyh+u8Xo8h7ODilH7jdcuu7QLw4aP Xk9ET/lVpMyrKO47fWFt87LsnRdHKgqrNU+mmnWRhKX19+B6gTJBSCT6faluaogZDUlPW9MaOLu X7LVgmFRL+b2Cpd/KgmzxklIwIusIIVwftISRJ2WOv X-Google-Smtp-Source: AGHT+IHGBE6ifrOu/S3K07EDhE3Razd6qUuKMjV5k0hkxoKOM5BFr6w5sMWcBQNeO68KzyQ0v3uzRg== X-Received: by 2002:a05:6402:358c:b0:639:4c9:9c9e with SMTP id 4fb4d7f45d1cf-64554456480mr21572408a12.10.1764272051907; Thu, 27 Nov 2025 11:34:11 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:1ce:374:d99c:26de:53b0]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-647510360dfsm2370825a12.18.2025.11.27.11.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 11:34:11 -0800 (PST) Message-ID: Subject: Re: how long should Archive logs be retained From: Laurenz Albe To: "Subramanian,Ramachandran" , "pgsql-novice@lists.postgresql.org" Date: Thu, 27 Nov 2025 20:34:10 +0100 In-Reply-To: <329482d836f34a548d071aab63961f11@alte-leipziger.de> References: <1f12660d233efc644edb6a23c7bd4bcc84b503af.camel@cybertec.at> <329482d836f34a548d071aab63961f11@alte-leipziger.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-11-27 at 15:49 +0000, Subramanian,Ramachandran wrote: > Archive logging is NOT enabled=C2=A0 and a transaction keeps filling up t= he logs one by one > till all the logs are full WITHOUT Any COMMIT. Then what happens?=C2=A0 D= oes Postgres hang > or does Postgres terminate this thread ? Neither. As I said, PostgreSQL will happily remove WAL segments that contain uncommi= tted transactions. PostgreSQL will never undo any work. If a transaction is ro= lled back, all the uncommitted data are still there, they are only invisible. Later, the autovacuum daemon (a kind of garbage collection) will remove the= se data, but that's a separate activity (that is again logged to WAL). > After reading your answers, I understand that Archive logs are needed ONL= Y if we want > to go back in time to a past point of consistency ( example=C2=A0 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.=C2=A0=C2=A0 1. Did I u= nderstand correctly ?=C2=A0 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 wan= t 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