"David G. Johnston" <david.g.johnston@xxxxxxxxx> writes: > On Thursday, July 4, 2024, Murthy Nunna <mnunna@xxxxxxxx> wrote: >> pg_terminate_backend(pid) will not work as it expects only one pid at a >> time. > Interesting…I wouldn’t expect the function calls to interact that > way TBH, my reaction to that was that the OP doesn't understand SQL semantics. As you previously said, simply removing the LIMIT clause should work fine. (The ORDER BY looks kinda pointless, too, unless there are operational constraints we weren't told about.) There is a question of exactly what "$a'${TIMEOUT_MINS}'$a" is supposed to mean, but that's independent of the LIMIT issue. regards, tom lane