From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Luca Ferrari <fluca1978@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: pg_wal lifecycle
Date: Tue, 13 Jul 2021 15:43:12 +0200
Message-ID: <5cd3241a-f1d3-9881-e3a2-823075d6d6c3@enterprisedb.com> (raw)
In-Reply-To: <CAKoxK+4L069ZjNAtJ9Vwio6wRVSw0Cpp50+SJ=QdRskogGcrfA@mail.gmail.com>
References: <CAKoxK+4L069ZjNAtJ9Vwio6wRVSw0Cpp50+SJ=QdRskogGcrfA@mail.gmail.com>
On 13.07.21 09:07, Luca Ferrari wrote:
> I'd like to see if I get it right about pg_wal: it grows up to pretty
> much max_wal_size, at which point a checkpoint is triggered.
> If the server triggers a timed checkpoint before the pg_wal is at
> max_wal_size, the system recycles the wals thus keeping the pg_wal
> size lower than max_wal_size.
> Is this correct? In particular, what is in simple words, the
> discrimination between recycling a segment and creating a new one?
Recycling in this context just means that instead of creating a new WAL
file for new WAL traffic, it reuses an old file. So if you have WAL
files 5, 6, 7, 8, 9, and you know that you don't need 5 and 6 anymore,
when you need to start WAL file 10, instead of creating a new file "10",
the system just renames "5" to "10" and starts overwriting what was in
there. This is just an optimization to use the file system better; it
doesn't affect the logical principles of what is going on.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: peter.eisentraut@enterprisedb.com, fluca1978@gmail.com
Subject: Re: pg_wal lifecycle
In-Reply-To: <5cd3241a-f1d3-9881-e3a2-823075d6d6c3@enterprisedb.com>
References: <CAKoxK+4L069ZjNAtJ9Vwio6wRVSw0Cpp50+SJ=QdRskogGcrfA@mail.gmail.com> <5cd3241a-f1d3-9881-e3a2-823075d6d6c3@enterprisedb.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox