Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAHEp-0001A7-Qu for pgsql-general@arkaria.postgresql.org; Wed, 10 Oct 2018 16:21:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gAHEn-0005wm-Kd for pgsql-general@arkaria.postgresql.org; Wed, 10 Oct 2018 16:21:29 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAHEn-0005wf-9G for pgsql-general@lists.postgresql.org; Wed, 10 Oct 2018 16:21:29 +0000 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gAHEj-0001l7-MU for pgsql-general@postgresql.org; Wed, 10 Oct 2018 16:21:27 +0000 Received: from smtp1.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 6C28749CD4; Wed, 10 Oct 2018 18:21:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id G8Wh6Fbp5O24; Wed, 10 Oct 2018 18:21:18 +0200 (CEST) Message-ID: <34d85bfc77e9a63890e28ea13953c30508233469.camel@cybertec.at> Subject: Re: how to identify the timeline of specified recovery_target_time when do multiple PITR From: Laurenz Albe To: magodo , pgsql-general@postgresql.org Date: Wed, 10 Oct 2018 18:21:15 +0200 In-Reply-To: References: <29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com> <0c552a0ee114314ceb026d65f75a98df3e8d22ff.camel@cybertec.at> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk magodo wrote: > > By default, recovery will stay on the timeline where it started. > > If you want to go to timeline 2 or 3, you have to specify > > recovery_target_timeline. > > > For me, the specified point corresponds to timeline 1, because at that > time, the timeline is 1 indeed (when there is no timeline 2 branched > out yet). > > So in other word, my expectation is like I want to get the first > timeline which covers the specified time. > > As you mentioned, there is no active timeline concept in postgres, then > what is the best practice to meet my expectation? Do I have to somehow > record the timestamp when archived wal's timeline has been changed, > then compare the specified recovery target time with those records to > find the first timeline which covers that time? As I wrote, that is the default behavior; PostgreSQL will stay on the timeline that was active when recovery was started. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com