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 1vseEU-00Bko0-1W for pgsql-novice@arkaria.postgresql.org; Wed, 18 Feb 2026 09:52:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vseET-00FI33-2B for pgsql-novice@arkaria.postgresql.org; Wed, 18 Feb 2026 09:52:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vseET-00FI2u-1J for pgsql-novice@lists.postgresql.org; Wed, 18 Feb 2026 09:52:33 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vseER-00000001CK5-0JMQ for pgsql-novice@lists.postgresql.org; Wed, 18 Feb 2026 09:52:32 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-48374014a77so46164355e9.3 for ; Wed, 18 Feb 2026 01:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1771408350; x=1772013150; 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=B9RQC9/qKuQkRcB0w6ErCl/GD5Fve3JGntLQKZ4lzHU=; b=KfiGLfA1wSEx6srrJjL75l1gYiEoapHFXEU0zD8U4/e4o0ZcZAikYspefVbHOE7/iO hnEAjOkacUMlVB9oXlrRxW1xdmg5UdwIe5stBXo8TKtJid35PGom7+nWFKkEgIQG108v wN7oDI1vvnSAQsYhb6Zgzq8DDaKX9IP22xSCD5gzn9VWCEbMrfxytH5pXm+mCsjK9gHN +7HBh3bT9Td0DbtKsFAvI05/J6C9UoDzrzQBB5eWL8zMOvcgCAt238dglYEPvICjkxBN 9SIzigirQsQWFCvmBDiaUau7THtOSTgtzO5Qqz4/sFoUv5R+Gh2ubDLLmumJ5bCJB0vS zJeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771408350; x=1772013150; 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=B9RQC9/qKuQkRcB0w6ErCl/GD5Fve3JGntLQKZ4lzHU=; b=luc0mOCYJISyAeGePnmBUqZAMyUsw6h/mjvp2r4jvM5DurymibfAbTqT9rlzMUWuSF 76REUt8atJArrihvbADGrCNO7EeiMVA8RgAs7usBYVSPrH1bNhs56WcnimAg16vFRyMO f6SOSLB/bDWG/LcztgLuT7qXGaj1sZdxdWWoq+zgk/rDSwDBjs6/voQQw6eok+QddYBu 5gvI0m70hVEl6ZP3ArvUumvM1cnQ4w5pz2GX5nuDb3heJQYyUKtCy3fh5EzZWb9yif5U 0n4n9L6kHmU772ipXCSf4qmgAfxtrKA1EkJl7+B69CtTBhaq69b887e0BLxknkktu1Xx wVMw== X-Forwarded-Encrypted: i=1; AJvYcCXUZkSvz7BBEAxaZbLk6n9sRPmcGWmB/plRqG8c5jVXbJht1jCyBnFoxFzh3QmU9rjD5PeM1Z1fbgCJQx4=@lists.postgresql.org X-Gm-Message-State: AOJu0YyUC4K+BU0SsmbOhWgCJH+iDrResMf4a67c687rmsSBe3f+gB/0 MZ5FQDwXkx2CJLUr5REyMjNgZiBK2JFolk9FQu4mL4J0B5g7Xfc18GaG77lle3OcVEOXT8lilJf szgSWYJw= X-Gm-Gg: AZuq6aJa7nS1e4vwliJla9PwdkZwIkVCFT3IVl7VtfgeKqexzl9AhVRQkuIPGc6wALW d8BJWe4jjCIhxdYw8qIubMlcKFCsPOXUJD1RAtZZaxlJ45/sObMkW9APRJ8oo6UfvFiUK7oGl5d nWLH+mbfsYGjOZGOrtZHNLo3q/VVhyt1ZpaXr1qYwha2sTZWwpMRFq7WqcAnuZuRVGcV3AcPfKo 91mMPKWcSY5U/2UxZysosfpHsIQ2XwndQYyhlIPibCd/E061LMC0JQ7L1FoLOif3Ng1HWCCY0KH 1BkUtPjg6lmlPd2uh2oqEW6GRNtYBJC9zd4ebDEcI8P5U4wrfjVF7VtjzxbyrZNHVJsKE145ADi dO9yix4mVKUfAelDc/c/C79Q/Iqu7s9Ur6pWVBvjvsZi55WLek17ykt+JbZcKcxFiY2Rhgwor3F 7RobUOajhMKT62OlSMumF8EFFmxRApheqTlyP7VbDIg8q4uQKfievo X-Received: by 2002:a05:600c:148f:b0:483:7f7c:ad89 with SMTP id 5b1f17b1804b1-4837f7cb108mr154105175e9.37.1771408350307; Wed, 18 Feb 2026 01:52:30 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:e982:5934:fe85:d4da:f7e9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d8334a8sm606563715e9.12.2026.02.18.01.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Feb 2026 01:52:29 -0800 (PST) Message-ID: Subject: Re: Please correct me - PIT - Redirected recovery From: Laurenz Albe To: "Subramanian,Ramachandran" , "pgsql-novice@lists.postgresql.org" Date: Wed, 18 Feb 2026 10:52:29 +0100 In-Reply-To: <8ee01402028e4fabb153a6420cce3a2a@alte-leipziger.de> References: <8ee01402028e4fabb153a6420cce3a2a@alte-leipziger.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2026-02-18 at 08:01 +0000, Subramanian,Ramachandran wrote: > I am formulating a backup strategy for our Production environment. > =C2=A0 > I use pg_basebackup ( naturally with archive logging ) . > =C2=A0 > I have successfully tested a full recovery and a point in time recovery a= t the source server. > =C2=A0 > I have also tested a full recovery in a secondory server with the backups= taken from the source server. > =C2=A0 > My question is regarding the possibility of a PIT recovery in the seconda= ry server. > =C2=A0 > =C2=A0=C2=A0=C2=A01. Is it possible to do a PIT Recovery in the secondary= server =C2=A0WITHOUT copying over the > archive logs from the primary server IF the recovery point lies WIT= HIN THE RANGE of the > logs contained in the pg_basebackup ? In other words is it possible= to rollforward within > the range of the logs present in pg_wal directory. The WAL included in the base backup (if you use the default option -X strea= m) is only up to the end of the backup, so you will only be able to recover that point in time (= as this is also the earliest point in time you can recover to. In other words: the only recovery target that will work reliably with the W= AL included in the pg_basebackup is "recovery_target =3D immediate". > =C2=A0=C2=A0=C2=A02. Where does Postgres keep track of the information ab= out which log was archived at what time? > =C2=A0 Is there a command =C2=A0to get this information from postgres= ? Nowhere. Each commit record in the WAL contains the commit timestamp, whic= h is used for point-in-time-recovery. PostgreSQL simply tries to restore WAL from the ar= chive until it gets an error or until it decides it needs no more. You'll see it trying to res= tore WAL segments that don't exist; that is to be expected. > =C2=A0=C2=A0=C2=A03. I have not tested this yet, but logic tells me that = IF I COPY over the ARCHIVE LOGS from the > source to the target server, then PIT Recovery should be possible. = Please correct me if I am wrong. Correct. But rather than doing such manipulations by hand, I recommend that you use = a tool like pgBackRest. That way, you don't have to re-invent the wheel. Yours, Laurenz Albe