Re: [PATCH v2] Re: Cancel problems of query to pg_stat_statements - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH v2] Re: Cancel problems of query to pg_stat_statements
Date
Msg-id acNuZJJORIgbZ03a@paquier.xyz
Whole thread Raw
In response to Re: Cancel problems of query to pg_stat_statements  (Andrey Borodin <x4mmm@yandex-team.ru>)
List 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

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Initial COPY of Logical Replication is too slow
Next
From: Corey Huinker
Date:
Subject: Re: SLOPE - Planner optimizations on monotonic expressions.