Re: [PATCH v2] Re: Cancel problems of query to pg_stat_statements

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Roman Khapov <rkhapov(at)yandex-team(dot)ru>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH v2] Re: Cancel problems of query to pg_stat_statements
Date: 2026-03-25 05:11:00
Message-ID: acNuZJJORIgbZ03a@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 12, 2025 at 03:48:29PM +0500, Roman Khapov wrote:
> Its true that qtext_load_file() can be called with acquired lock in
> pg_stat_statements_internal()...
> So I perform INTERRUPTS_PENDING_CONDITION in v2 patch and call
> CHECK_FOR_INTERRUPTS later, after cycle ended and lock released.

This patch is only a workaround for a larger problem: the PGSS text
file does not and will never scale once it reaches a large size and
once we have a high turnover rate of the PGSS entries due to different
query IDs.

FWIW, Sami Imseih has mentioned to me a few days ago that the state of
the pgstats API (that can be used for custom stats kinds as well) was
basically in a shape good enough to move PGSS to pgstats as a custom
kind, and we should be able to move the query text file to be entirely
in-memory. This proposal will hopefully materialize at the beginning
of the v20 cycle.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2026-03-25 05:18:12 Re: SLOPE - Planner optimizations on monotonic expressions.
Previous Message Masahiko Sawada 2026-03-25 05:06:54 Re: Initial COPY of Logical Replication is too slow