pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Henry Francisco Garcia Cortez <garcortez@gmail.com>
Cc: pgsql-admin@postgresql.org, Laurenz Albe <laurenz.albe@cybertec.at>
Subject: Re: bgwriter and checkpoints
Date: Fri, 3 Sep 2021 17:22:09 -0400
Message-ID: <202109032122.sym3vzjum5g3@alvherre.pgsql> (raw)
In-Reply-To: <CAJP2v3E4vNx8CBsnt7W4ACs7ujk-ZmvBTCpSjamQRRYPmRLAOw@mail.gmail.com>

On 2021-Sep-03, Henry Francisco Garcia Cortez wrote:

> Hi community, I was reading about background writer process and
> checkpoints, but I still don't understand very well. How do they work for
> instance I understand this if a row was updated,those changes will be on
> shared buffers, then those changes will go to path on disk called pg_wall,
> then when a checkpoint will be executed and finally, those changes will go
> to data files when bgwriter process will be executed but I found a blog on
> internet they say that after each search, the BGWRITER chooses some number
> of modified pages, writes them to disk, and evicts those pages from the
> shared buffer pool.

Everything you wrote here is correct.  Row changes are logged to WAL
(which is a journal -- always written to disk), and initially remain in
shared buffers.  They can be written down from shared buffers to disk
either at a checkpoint, or by bgwriter.  If they're not written down by
those processes, and the system crashes, then when the system comes
back, WAL is read and replayed.  This restores the change that was done
before the crash.

> https://flylib.com/books/en/2.290.1/the_postgresql_bgwriter_process.html

I'm not familiar with this book.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/





view thread (3+ messages)  latest in thread

Message-ID: <202109032122.sym3vzjum5g3@alvherre.pgsql>
Permalink:  ../202109032122.sym3vzjum5g3@alvherre.pgsql/
Also on:    postgresql.org/message-id/202109032122.sym3vzjum5g3@alvherre.pgsql

 · 

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-admin@postgresql.org
  Cc: alvherre@2ndquadrant.com, garcortez@gmail.com, laurenz.albe@cybertec.at
  Subject: Re: bgwriter and checkpoints
  In-Reply-To: <202109032122.sym3vzjum5g3@alvherre.pgsql>

* 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