Re: pg_stat_statements: Add `calls_aborted` counter for tracking query cancellations - Mailing list pgsql-hackers

From Benoit Tigeot
Subject Re: pg_stat_statements: Add `calls_aborted` counter for tracking query cancellations
Date
Msg-id CAHUgstBR94wCkNRQLJgM5rDEw3b=fc8D5FEygn_ZHzSMWmjDSQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_stat_statements: Add `calls_aborted` counter for tracking query cancellations  (Michael Paquier <michael@paquier.xyz>)
Responses Re: pg_stat_statements: Add `calls_aborted` counter for tracking query cancellations
List pgsql-hackers
Thanks Michael

Thu, Aug 14, 2025 at 10:18 AM, Michael Paquier <michael@paquier.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



pgsql-hackers by date:

Previous
From: Kirill Reshke
Date:
Subject: Re: ALTER DOMAIN ADD NOT NULL NOT VALID
Next
From: Fabrice Chapuis
Date:
Subject: Re: Issue with logical replication slot during switchover