how long should Archive logs be retained - Mailing list pgsql-novice

From Subramanian,Ramachandran
Subject how long should Archive logs be retained
Date
Msg-id a02ba9c8a1c046d292766096eecd2631@alte-leipziger.de
Whole thread Raw
Responses Re: how long should Archive logs be retained
List pgsql-novice

Hello,

 

 

    Kindly excuse my lack of knowledge.  I am new to Postgres and I  want to make sure that I am doing the right thing.

 

 

How long should archived logs be retained?

 

I make pg_basebackups once  a day  with wal-method ‚stream‘  and postgresql.conf has wal_level = replica and  archive_mode=on

 

Case 1:  Recovery to the point in time when the basebackup ended--  Am I correct in assuming that I do not need anything else other than the base backup if I want to just recover to the point in time when the basebackup ended?   Please correct me if I am wrong.

 

Case 2: Recovery to the latest point – For example if a server crashes, I can simply restart the server and postgres and it will rollforward all the active logs since the last flush oft he data buffers to disk happened . Is my understanding correct ?  While I understand that all the log buffers are written as soon as a commit is issued, how does Postgres keep track of when the data buffers were flushed to disk? In other words, how does Postgres know from which log sequence number it must begin rolling forward?  Can we as users also see it?

 

Case 3:  No archive logging and transaction that does not commit:  Let us say that we have not enabled archive logging and we have a long running update that fills up all the active logs (WALs) and it has wrapped around. What happens now?  Will the system Hang?  Will Postgres cancel this thread and rollback?  Should we manually cancel the thread?  How can we find out which thread is writing without commits?

 

Case 4: Recovery to the latest point with Archive logging enabled:  If  I have archive logging enabled and I have transactions that wrap around the logs without commit and the server crashes,  is it correct to assume that  I need

  1. my base backup ( with all the ‚then copied WALs‘ )
  2.  the current WALs in the active WAL directory
  3. All the archived WALs from the time the base backup began to the time the crash happened

 

to bring the system to a consistent state?

 

 

My question in short is, Is it enough if I hold on to my archive logs since the last backup for any recovery scenareo?

 

 

Thank you so much for your time

 

 

LG

 

Ram


Freundliche Grüße

i. A. Ramachandran Subramanian

Zentralbereich Informationstechnologie

Alte Leipziger Lebensversicherung a. G.

Hallesche Krankenversicherung a. G.

______________________

ALH Gruppe
Alte Leipziger-Platz 1, 61440 Oberursel
Tel: +49 (6171) 66-4882
Fax: +49 (6171) 66-800-4882
E-Mail: ramachandran.subramanian@alte-leipziger.de
www.alte-leipziger.de
www.hallesche.de

Alte Leipziger Lebensversicherung a. G., Alte Leipziger-Platz 1, 61440 Oberursel

Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape, Wiltrud Pekarek, Udo Wilcsek

Sitz Oberursel (Taunus) · Rechtsform VVaG · Amtsgericht Bad Homburg v. d. H. HRB 1583 · USt.-IdNr. DE 114106814

Hallesche Krankenversicherung a. G., Löffelstraße 34-38, 70597 Stuttgart

Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape, Wiltrud Pekarek, Udo Wilcsek

Sitz Stuttgart · Rechtsform VVaG · Amtsgericht Stuttgart HRB 2686 · USt.-IdNr. DE 147802285

Beiträge zu privaten Kranken- und Pflegekrankenversicherungen unterliegen nicht der Versicherungsteuer (§ 4 (1) Nr. 5 b VersStG) · Versicherungsleistungen sowie Umsätze aus Versicherungsvertreter-/Maklertätigkeiten sind umsatzsteuerfrei

Pflichtangaben der ALH Gruppe gemäß § 35a GmbHG bzw. § 80 AktG

pgsql-novice by date:

Previous
From: "Subramanian,Ramachandran"
Date:
Subject: Commit effect on WAL-Writer behaviour
Next
From: Laurenz Albe
Date:
Subject: Re: how long should Archive logs be retained