On Mon, 2023-11-27 at 21:07 -0700, David G. Johnston wrote: > On Monday, November 27, 2023, Nikhil Ingale <niks.bgm@xxxxxxxxx> wrote: > > How do I find out what query is it running? > > > > SAVEPOINT _per_query_svp_;DEALLOCATE "_PLAN0x7fdd58004550";RELEASE _per_query_svp_ > > > > That is the last command (multi-statement though it is) that was executed before the transaction/session went idle. ... and it points towards a problem that is quite unrelated to the actual question. There seems to be an automatism in your application that wraps every statement in a subtransaction to emulate statement-level rollback. That will cause severe performance problems: https://www.cybertec-postgresql.com/en/subtransactions-and-performance-in-postgresql/ So your application is broken not only because it does not close its transactions. Yours, Laurenz Albe