Re: Avoiding roundoff error in pg_sleep()

From: Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Avoiding roundoff error in pg_sleep()
Date: 2025-09-26 15:25:09
Message-ID: cbeb760a947acc2deab9cda0ee3782ef@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi David,

David G. Johnston писал(а) 2025-09-26 18:08:
> On Friday, September 26, 2025, Vladlen Popolitov
> <v(dot)popolitov(at)postgrespro(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-09-26 15:25:19 Re: test_json_parser/002_inline is kind of slow
Previous Message Robert Haas 2025-09-26 15:11:52 test_json_parser/002_inline is kind of slow