Re: Improve pg_stat_statements scalability

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, lukas(at)fittl(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Improve pg_stat_statements scalability
Date: 2026-06-24 04:17:55
Message-ID: ajtac8Fml_UPB6uL@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 12, 2026 at 06:21:42PM -0500, Sami Imseih wrote:
> I have implemented an approach, which I will share in the next
> revision, where every stats kind is written to its own dedicated
> dshash rather than into the common one. This is a new
> configuration in PgStat_KindInfo where an extension (or even a
> core stats kind) can request to be placed in a dedicated hash,
> else in the common hash.
>
> I like this better, especially for kinds with unique access
> patterns like pg_stat_statements, where the view function and
> eviction need to iterate over all their own entries frequently.
> A dedicated hash eliminates the full-scan problem without a
> secondary coordination dshash.

I'm finding this alternative quite appealing, indeed. For PGSS, I was
wondering about how it would be possible to avoid a secondary hash,
and I did not consider an approach where we could bypass the main one.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-06-24 04:47:11 Re: enhance wraparound warnings
Previous Message Gilles Darold 2026-06-24 04:15:21 Re: Global temporary tables