Re: Avoiding roundoff error in pg_sleep()

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Пополитов Владлен <v.popolitov@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-09-25T19:36:18Z
Lists: pgsql-hackers
=?utf-8?q?=D0=9F=D0=BE=D0=BF=D0=BE=D0=BB=D0=B8=D1=82=D0=BE=D0=B2_=D0=92=D0=BB=D0=B0=D0=B4=D0=BB=D0=B5=D0=BD?= <v.popolitov@postgrespro.ru> writes:
> I suspect, that any user, that run something like pg_sleep(1000000000), 
> start transaction, that stops autovacuum and creates other negative effects up to server crash,
> and only this user can stop it by command interrupt (all signals only restart 
> this sleep or kill whole server).

How is this different from any other long-running query?
If you'd bothered to test, you'd have seen that pg_sleep()
is interruptible by query cancel, just like anything else,
so "kill whole server" is not required.

We're not in the business of trying to limit users' resource
consumption.  If we wanted to do that, it'd be a very major
undertaking.

			regards, tom lane



Commits

  1. Try to avoid floating-point roundoff error in pg_sleep().