Re: pg_stat_io_histogram

From: Andres Freund <andres(at)anarazel(dot)de>
To: Ants Aasma <ants(dot)aasma(at)cybertec(dot)at>
Cc: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_stat_io_histogram
Date: 2026-02-19 18:12:37
Message-ID: s7wmiyblwwsjdsnzcojh77mvj4qnnfhpeng5qfnk7cybnslfhn@lpev3xq2mbdd
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-02-19 19:55:06 +0200, Ants Aasma wrote:
> > Right now the lowest bucket is for 0-8 ms, the second for 8-16, the third for
> > 16-32. I.e. the first bucket is the same width as the second. Is that
> > intentional?
>
> If the boundaries are not on power-of-2 calculating the correct bucket
> would take a bit longer.

Powers of two make sense, my point was that the lowest bucket and the next
smallest one are *not* sized in a powers of two fashion, unless I miss
something?

> For reducing the number of buckets one option is to use log base-4 buckets
> instead of base-2.

Yea, that could make sense, although it'd be somewhat sad to lose that much
precision.

> But if we are worried about the size, then reducing the number of histograms
> kept would be better.

I think we may want both.

> Many of the combinations are not used at all

Yea, and for many of the operations we will never measure time and thus will
never have anything to fill the histogram with.

Perhaps we need to do something like have an array of histogram IDs and then a
smaller number of histograms without the same indexing. That implies more
indirection, but I think that may be acceptable - the overhead of reading a
page are high enough that it's probably fine, whereas a lot more indirection
for something like a buffer hit is a different story.

> and for normal use being able to distinguish latency profiles between so
> many different categories is not that useful.

I'm not that convinced by that though. It's pretty useful to separate out the
IO latency for something like vacuuming, COPY and normal use of a
relation. They will often have very different latency profiles.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexandre Felipe 2026-02-19 18:12:41 Idea memory credit system
Previous Message Ants Aasma 2026-02-19 18:07:42 Re: Hash aggregate collisions cause excessive spilling