Re: pg_stat_io not tracking smgrwriteback() is confusing

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: pg_stat_io not tracking smgrwriteback() is confusing
Date: 2023-04-24 05:22:15
Message-ID: CAA4eK1LDY9P9NPJvkx87d43sCcMOu1JGs6fm0KGmbtbJjmKAVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 23, 2023 at 12:55 AM Jonathan S. Katz <jkatz(at)postgresql(dot)org> wrote:
>
> On 4/19/23 1:23 PM, Andres Freund wrote:
> > Hi,
> >
> > I noticed that the numbers in pg_stat_io dont't quite add up to what I
> > expected in write heavy workloads. Particularly for checkpointer, the numbers
> > for "write" in log_checkpoints output are larger than what is visible in
> > pg_stat_io.
> >
> > That partially is because log_checkpoints' "write" covers way too many things,
> > but there's an issue with pg_stat_io as well:
> >
> > Checkpoints, and some other sources of writes, will often end up doing a lot
> > of smgrwriteback() calls - which pg_stat_io doesn't track. Nor do any
> > pre-existing forms of IO statistics.
> >
> > It seems pretty clear that we should track writeback as well.

Agreed. +1.

> > I wonder if it's
> > worth doing so for 16? It'd give a more complete picture that way. The
> > counter-argument I see is that we didn't track the time for it in existing
> > stats either, and that nobody complained - but I suspect that's mostly because
> > nobody knew to look.
>
> [RMT hat]
>
> (sorry for slow reply on this, I've been out for a few days).
>
> It does sound generally helpful to track writeback to ensure anyone
> building around pg_stat_io can see tthe more granular picture. How big
> of an effort is this?
>

Right, I think this is the key factor to decide whether we can get
this in PG16 or not. If this is just adding a new column and a few
existing stats update calls then it should be okay to get in but if
this requires some more complex work then we can probably update the
docs.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-04-24 05:24:11 Re: Perform streaming logical transactions by background workers and parallel apply
Previous Message vignesh C 2023-04-24 04:04:54 Re: Add two missing tests in 035_standby_logical_decoding.pl