public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Scott Ribe <[email protected]>
Cc: pgsql-admin <[email protected]>
Subject: Re: pg_stat_statements, write activity
Date: Mon, 19 May 2025 08:57:38 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

On Sat, 2025-05-17 at 08:50 -0600, Scott Ribe wrote:
> > On May 16, 2025, at 1:37 PM, Laurenz Albe <[email protected]> wrote:
> > 
> > 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.
> 
> Ah, that's the piece I was missing!
> 
> Do the written blocks get counted as dirty first, or only as written?

They will certainly be dirty as well.  You can use simple experiments to answer
questions like this:

CREATE TABLE new(id integer);

EXPLAIN (ANALYZE, BUFFERS, COSTS OFF, SUMMARY OFF) INSERT INTO new VALUES (42);

                         QUERY PLAN                         
════════════════════════════════════════════════════════════
 Insert on new (actual time=0.165..0.166 rows=0.00 loops=1)
   Buffers: shared dirtied=1 written=1
   ->  Result (actual time=0.002..0.003 rows=1.00 loops=1)

Yours,
Laurenz Albe


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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: pg_stat_statements, write activity
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox