Re: how to identify the timeline of specified recovery_target_timewhen do multiple PITR - Mailing list pgsql-general

From Laurenz Albe
Subject Re: how to identify the timeline of specified recovery_target_timewhen do multiple PITR
Date
Msg-id ec9fb3bf4873aa450f67556c3bbda85c8e4f1d34.camel@cybertec.at
Whole thread Raw
In response to how to identify the timeline of specified recovery_target_time whendo multiple PITR  (magodo <wztdyl@sina.com>)
List pgsql-general
magodo wrote:
> > How can you know how many WAL segments there are on timeline 1, and if
> > there is one that extends past 2018-10-11 12:00:00 or not?
> 
> This is the exact problem I want to figure out. My approach is as you said,
> I will parse each archived WAL segment via `pg_xlogdump -r Transaction`,
> and try to find the first least earliest WAL against the specified time.
> This is a linear search, which has complexity of O(n).

That means that the time spent grows linearly, but it is still a lot of time
if there are a lot of WAL archives.

> So if you want to recover to that point of time, how do you choose the timeline?

PostgreSQL doesn't provide auch a functionality, and I can think of three reasons:
1) the high cost as mentioned above
2) during archive recovery, it does not happen very often that you have to
   choose between timelines at all.  It is more typical for streaming replication.
3) nobody saw a use case for such a functionality

If you really need this functionality, you'll have to write it yourself.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com



pgsql-general by date:

Previous
From: magodo
Date:
Subject: Re: how to identify the timeline of specified recovery_target_timewhen do multiple PITR
Next
From: Abhishek Tripathi
Date:
Subject: Re: Want to acquire lock on tables where primary of one table isforeign key on othere