Vladlen Popolitov <v.popolitov@postgrespro.ru> writes:
> Tom Lane писал(а) 2025-09-25 22:36:
>> How is this different from any other long-running query?
> I will try to explain my worries about this. Long running queries could
> run long
> due to higher input-output, and they are limited at least by work_mem
> parameter.
> pg_sleep() is not limited by anything.
So I assume for example, that you would also argue for removing
all looping constructs from pl/pgsql so that users could not
write infinite loops?
DO $$ BEGIN LOOP END LOOP; END $$;
is just as effective a blocking transaction as pg_sleep,
plus it consumes a CPU.
I think the right answer to concerns like this is transaction_timeout
and similar features, not arbitrary restrictions.
regards, tom lane