Re: pg_stat_statements: Add `calls_aborted` counter for tracking query cancellations

From: Benoit Tigeot <benoit(dot)tigeot(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stat_statements: Add `calls_aborted` counter for tracking query cancellations
Date: 2025-08-14 09:04:27
Message-ID: CAHUgstBR94wCkNRQLJgM5rDEw3b=fc8D5FEygn_ZHzSMWmjDSQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks Michael

Thu, Aug 14, 2025 at 10:18 AM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> That seems kind of limited to me in scope. The executor is only one
> part of the system. I would have considered using an xact callback
> when a transaction is aborted if I were to do a patch like the one you
> are proposing, to know how many times a transaction is failing at a
> specific phase, because you should know the latest query_id in this
> case to be able to put a counter update in the correct slot (right?).

I will make a v5 patch with this approach. It should also address your
second comment about using `pg_sleep` in the test. I used this
approach because it sounds that it's the closest to a real timeout
issue in production, more like integration testing. I will try to
change that with the new patch.
__________
Benoit Tigeot

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrice Chapuis 2025-08-14 09:09:13 Re: Issue with logical replication slot during switchover
Previous Message Kirill Reshke 2025-08-14 09:02:27 Re: ALTER DOMAIN ADD NOT NULL NOT VALID