pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jürgen Purtz <juergen@purtz.de>
To: pgsql-novice@postgresql.org
Subject: Re: Sequence of processing: WAL / shared buffers
Date: Fri, 29 Jan 2016 10:54:20 +0100
Message-ID: <56AB36CC.9050800@purtz.de> (raw)
In-Reply-To: <CAFe9ZToZy6tqSUmsNZaRi7igQzw5oQfo1hqO6RBoU3zGd-w4uQ@mail.gmail.com>
References: <20160105193334.GA296052@alvherre.pgsql>
	<5690218B.9060103@purtz.de>
	<56AA0064.1010807@purtz.de>
	<CAFe9ZToZy6tqSUmsNZaRi7igQzw5oQfo1hqO6RBoU3zGd-w4uQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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@purtz.de 
> <mailto:juergen@purtz.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@postgresql.org
>     <mailto:pgsql-novice@postgresql.org>)
>     To make changes to your subscription:
>     http://www.postgresql.org/mailpref/pgsql-novice
>
>
>
>
> -- 
> Regards,
> Ang Wei Shan

view thread (3+ messages)

Message-ID: <56AB36CC.9050800@purtz.de>
Permalink:  ../56AB36CC.9050800@purtz.de/
Also on:    postgresql.org/message-id/56AB36CC.9050800@purtz.de

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: juergen@purtz.de, pgsql-novice@postgresql.org
  Subject: Re: Sequence of processing: WAL / shared buffers
  In-Reply-To: <56AB36CC.9050800@purtz.de>

* 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