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

From Vladlen Popolitov
Subject Re: Avoiding roundoff error in pg_sleep()
Date
Msg-id cbeb760a947acc2deab9cda0ee3782ef@postgrespro.ru
Whole thread Raw
In response to Re: Avoiding roundoff error in pg_sleep()  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Avoiding roundoff error in pg_sleep()
Re: Avoiding roundoff error in pg_sleep()
List pgsql-hackers
Hi David,

David G. Johnston писал(а) 2025-09-26 18:08:
> On Friday, September 26, 2025, Vladlen Popolitov
> <v.popolitov@postgrespro.ru> wrote:
>
>> It looks like sleep has the wrong place in a function. It should be
>> an utility command, that does not start a transaction.
>
> Then write that command.  We’re not going to change pg_sleep.
> It’s works just as advertised.

It _does_ not work as it advertised. Help page states:
1) "delay execution of the server process"
2) "pg_sleep makes the current session's process sleep"
In reality it stops other backends too.

> True, it probably should never be
> used in production.
yes, it should not be used, if you know, but even advanced users do
not know the effect of this function. And it can be used by any user
of the server.

I just pointed attention, that this function could have bigger problem
with high values of parameter, not only very small, if you consider
problem with small value is really problem.

--
Best regards,

Vladlen Popolitov.



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: test_json_parser/002_inline is kind of slow
Next
From: Nathan Bossart
Date:
Subject: Re: test_json_parser/002_inline is kind of slow