Re: bgwriter and checkpoints

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Henry Francisco Garcia Cortez <garcortez(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Subject: Re: bgwriter and checkpoints
Date: 2021-09-03 21:22:09
Message-ID: 202109032122.sym3vzjum5g3@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2021-09-03 22:16:24 Re: bgwriter and checkpoints
Previous Message Henry Francisco Garcia Cortez 2021-09-03 20:56:29 bgwriter and checkpoints