Re: Avoiding roundoff error in pg_sleep()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vladlen Popolitov <v.popolitov@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-09-26T15:10:19Z
Lists: 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
Commits
-
Try to avoid floating-point roundoff error in pg_sleep().
- 02c4bc88302a 19 (unreleased) landed