Re: Cancel problems of query to pg_stat_statements - Mailing list pgsql-hackers

From Andrey Borodin
Subject Re: Cancel problems of query to pg_stat_statements
Date
Msg-id 26A1F7AF-810A-4D60-A6CB-8B749BCCE747@yandex-team.ru
Whole thread Raw
List pgsql-hackers

> On 24 Apr 2025, at 22:49, Roman Khapov <rkhapov@yandex-team.ru> wrote:
>
> Hi!
>  Recently we faced a problem in out production psql installation, which was that we had to cancel all requests to the
db,including performance monitoring requests, that uses ps_stat_statements. But we could not cancel the request in
usualway, and had to kill -9 the pg process of it. 

Interesting problem, thanks for raising it!

>  We've noticed that the the query execution stuck on PGSS_TEXT_FILE file reading in function qtext_load_file, which
doesn'thave CHECK_FOR_INTERRUPTS in the read cycle. In addition to our case with large PGSS_TEXT_FILE (and maybe the
problemswith virtual disk i/o) that can explain uncancellable pg_stat_statements queries. 

I'm afraid it might be not so easy to add CHECK_FOR_INTERRUPTS there. Most probably you was holding a
LWLockAcquire(pgss->lock,LW_SHARED) somewhere (do you have a backtrace?), which prevent interrupts anyway. 

Thanks!


Best regards, Andrey Borodin.


pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: using index to speedup add not null constraints to a table
Next
From: shveta malik
Date:
Subject: Re: Fix slot synchronization with two_phase decoding enabled