Re: Sequence of processing: WAL / shared buffers

From: Jürgen Purtz <juergen(at)purtz(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Sequence of processing: WAL / shared buffers
Date: 2016-01-29 09:54:20
Message-ID: 56AB36CC.9050800@purtz.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-novice

OK, so I guess the sequence with synchronous_commit=ON is:

1. client requests any UPDATE - and waits until step 4 is finished
2. bp_c (backend process of this client) modifies shared buffers
3. bp_c writes changes to WAL buffers
4. bp_c confirms the UPDATE request
5. client requests COMMIT - and waits until step 10 is finished
6. bp_c writes COMMIT to WAL buffers
7. bp_c requests 'write and flash WAL buffers to file' from WAL writer
process - and waits until step 9 is finished
8. WAL writer writes and flushes WAL buffers
9. WAL writer confirms to bp_c
10. bp_c confirms the COMMIT to client
11. Background Writer writes shared buffers to disc - asynchronous, at
any time.

Maybe, #2 and #3 are in reverse order? Or even in parallel?

Regards, Jürgen Purtz

On 28.01.2016 13:57, Wei Shan wrote:
> Hi Jurgen,
>
> If synchronous_commit is enabled, transaction commit will wait for WAL
> records to be written to disk before the command returns a
> "success" indication to the client. Shared buffers is not involved
> when commit is issued. For flushing of shared buffers to data files,
> we can use checkpoint instead. BGWR in charge of writing
> shared_buffers to the datafiles.
>
> Thanks!
>
> On 28 January 2016 at 19:49, Jürgen Purtz <juergen(at)purtz(dot)de
> <mailto:juergen(at)purtz(dot)de>> wrote:
>
> Hi,
>
> can anyone explain, what happens first during an UPDATE of an
> indexed column: writing and flushing to WAL or modification of
> shared buffers? And: both actions are finished before a
> confirmation is send to the requesting client - or?
>
> Regards, Jürgen Purtz
>
>
>
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org
> <mailto:pgsql-novice(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>
>
>
>
> --
> Regards,
> Ang Wei Shan

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Fujii Masao 2016-02-01 13:08:09 Re: Fwd: [DOCS] pgbench doc typos
Previous Message Wei Shan 2016-01-28 12:57:25 Re: Sequence of processing: WAL / shared buffers

Browse pgsql-novice by date

  From Date Subject
Next Message mnts 2016-01-31 11:56:09 Can't start PostgreSQL service on Windows and it's quite urgent
Previous Message Wei Shan 2016-01-28 12:57:25 Re: Sequence of processing: WAL / shared buffers