Re: pg_stat_statements, write activity

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>, pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_stat_statements, write activity
Date: 2025-05-16 19:37:26
Message-ID: ff7c4f6961ff733960920107357e2831a00d5b6c.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, 2025-05-16 at 11:10 -0600, Scott Ribe wrote:
> I would guess that shared_blks_dirtied in pg_stat_statements is basically the
> count of blocks which will be logged into WAL and written back during checkpoints.
> So then what is shared_blks_written? Or do I misunderstand shared_blks_dirtied???

The statistics track how many blocks were dirtied or written by the backend process
that performed the SQL statement. Typically, the backend only dirties the blocks,
but doesn't write them to disk itself. This is done by the checkpointer or the
background writer later on.

Sometimes, a backend writes a block to disk itself. This might happen if a lot
of cache pressure, but usually it happens when the table is extended with new
blocks.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2025-05-17 14:50:53 Re: pg_stat_statements, write activity
Previous Message Achilleas Mantzios 2025-05-16 19:25:19 Re: pg_stat_statements, write activity