1

After I issue pg_basebackup -D /var/lib/postgresql/basebackup -l "backup main $(hostname) on $(date)" -P, i see there are 2 ".backup' files in pg_wal directory. See it here. This is what pg_archive directory looks like here. Questions :

  1. Why are there 2 files ?
  2. Which WAL files can I delete safely, before the first ".backup" file (everything on top of **96.00000028) or before the second one (everything on top of **98.00000028) ?
  3. Or do I have to delete wal files (all files above the 00028) in pg_archive ?

Thanks

1 Answer 1

4

You can never delete pg_wal files. pg_wal is the directory that contains the primary WAL files, and there will never be a *.backup file in it. What you can delete are archived WAL files as written by archive_command or pg_receivewal.

Assuming you are talking about WAL archives, you can delete everything before (but not including) 000000010000000000000096 if you don't need to restore backups older than the one associated with 000000010000000000000096.00000028.backup. This can be done conveniently with the pg_archivecleanup utility.

You have two *.backup files because you performed two backups. Perhaps it was not you, but someone else.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.