Re: Avoiding roundoff error in pg_sleep() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Avoiding roundoff error in pg_sleep()
Date
Msg-id 4062677.1758899419@sss.pgh.pa.us
Whole thread Raw
In response to Re: Avoiding roundoff error in pg_sleep()  (Vladlen Popolitov <v.popolitov@postgrespro.ru>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Avoiding roundoff error in pg_sleep()
Next
From: Robert Haas
Date:
Subject: test_json_parser/002_inline is kind of slow