Re: Too many WAL archive files - Mailing list pgsql-admin

From Matheus de Oliveira
Subject Re: Too many WAL archive files
Date
Msg-id CAJghg4+6yASQfkXYPkeP_wXj5Q9dW+4Ubi=PVtW9sQZgBm5DRQ@mail.gmail.com
Whole thread Raw
In response to Too many WAL archive files  (Keith Ouellette <Keith.Ouellette@Airgas.com>)
Responses Re: Too many WAL archive files
Re: Too many WAL archive files
Re: Too many WAL archive files
List pgsql-admin

On Sat, Sep 14, 2013 at 11:19 AM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

My company is using PostgreSQL 9.1 for one of our applications. We have it set up replicating between two sites using WAL and Pacemaker to manage the cluster and failover. I have noticed that archive folder is growing very large 16G out of the 19G that the data directory is in total. We have the wal_keep_segments = 1000 set in the postgresql.conf file.

 

I thought that meant to keep the last 1000 files in the event that it was needed to catch up after falling behind.


No. PostgreSQL will always keep at least (can be a little more) wal_keep_segments files in any situation. So, wal_keep_segments is set to 1000, and each wal file has 16MB, doing the math it means PostgreSQL will use at least 15.625GB (~16GB) for wal files, it is what you have. If you don't have enough space for this, you should set keep wal_keep_segments to a lower value.

I am noticing that I have 12000 files in the archive directory. I know that includes the .backup files as well, but that is a smaller portion of the files in that directory.


Unless you have a lot of .backup files, there is no way 12000 wal file will use only 16GB, it would be 187.5GB, so this number seems wrong.

Also check if you have set up archiving and if it is working, because if archive_command fails, PostgreSQL will keep the "failed on archive" files on pg_xlog path and keep trying it.

Best regards,
-- 
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres

pgsql-admin by date:

Previous
From: Keith Ouellette
Date:
Subject: Too many WAL archive files
Next
From: Kevin Grittner
Date:
Subject: Re: wrong database name in error message?