Re: how to truncate/purge the pg_xlog directory? - Mailing list pgsql-general

From Richard Huxton
Subject Re: how to truncate/purge the pg_xlog directory?
Date
Msg-id 470F54A6.4080306@archonet.com
Whole thread Raw
In response to Re: how to truncate/purge the pg_xlog directory?  (tfinneid@student.matnat.uio.no)
Responses Re: how to truncate/purge the pg_xlog directory?
List pgsql-general
tfinneid@student.matnat.uio.no wrote:
>> tfinneid@student.matnat.uio.no wrote:
>>
>> OK, so that's 7 files?
>> What is your checkpoint_segments setting in postgresql.conf? If it's 3
>> then you can indeed expect a maximum of 7 WAL files. For a low-activity
>> system you can always turn the setting down.
>
> The setting was not set, so I expect that it used the default value of 3.
> I tried setting it to 1, and restarted the server, but nothing happened
> with the directories. Is there something that triggers the cleaning of it?
>
> Another thing, I dont understand how a setting of 3 leads to 7 files since
> one segment is 16MB, 3 segments should be be 3 files i.e. 48MB not 113MB.
> Am I misunderstanding something?

This parameter actually controls when a checkpoint is forced.
Indirectly, that affects the number of WAL files kept around. It's
actually (2*checkpoint_segments + 1). For those that are interested it's
"XLOGfileslop" in backend/access/transam/xlog.c.

As checkpoints are issued, old WAL files will either be recycled
(renamed) or deleted. Change the setting, then try (as user postgres)
issuing a "vacuum full <tbl>" followed by "SELECT pg_switch_xlog()" that
should recycle them quicker. That'll only get you down to 3 or 4 files
though - that's the minimum.

>>> Also the base/ directory is 268MB big and still not many tables, is ti
>>> possible to purge that directory as well?.
>> You might find the "pg_xxx_size()" functions useful - they are detailed
>> in the functions/system-admin chapter of the manuals.
>
> Can you be a bit more specific? I tried looking for it, but the sections
> are too big to just browse unknown information.

Try looking again, perhaps?
Go to the online manuals, go to the section on "functions and operators"
then to the section on "system administration functions". The first
ocurrence of the word "size" on that page is a heading for the bit you need.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: tfinneid@student.matnat.uio.no
Date:
Subject: Re: how to truncate/purge the pg_xlog directory?
Next
From: Nico Sabbi
Date:
Subject: Re: ORDER BY - problem with NULL values