wal_keep_segments and max_wal_size

From: Atul Kumar <akumar14871(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: wal_keep_segments and max_wal_size
Date: 2021-07-05 11:15:09
Message-ID: CA+ONtZ7jx6WnuRkRXUXfzu9kbjsWqE1ntQsMyAiif=W0vQZO7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

(on postgres 9.6) I was just practicing to make my no. of wal files in
pg_xlog directory to be the same/equal as I pass on wal_keep_segments
paramater.

say for example
show wal_keep_segments;
wal_keep_segments
-------------------
125

so I want my wal files should not be grow in numbers more than 125 so
for that I have changed the parameter of max_wal_size to 2 GB to limit
the size of pg_xlog directory.

show max_wal_size;
max_wal_size
--------------
2GB
(1 row)

but I did some testing by bulk inserts then the number of wal files
has grown more than 125.

and the size of pg_xlog directory also reached to 2.7 GB.

/data/apps/edb/as96/data/pg_xlog 04:05:08]$ ls | wc -l
173

/data/apps/edb/as96/data 04:05:11]$ du -sh pg_xlog/
2.7G pg_xlog/

I wonder why I faced such behavior bcz I limited the size of pg_xlog
directory by setting max_wal_size to 2GB that should be equivalent to
around 125 number of wal file in the pg_xlog directory.

please suggest how should I make both identical (wal_keep_segments and
max_wal_size).

regards,
Atul

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Atul Kumar 2021-07-05 11:18:04 Re: number of wal file is not reduced.
Previous Message hubert depesz lubaczewski 2021-07-05 10:51:26 Re: number of wal file is not reduced.