Re: Avoiding roundoff error in pg_sleep()

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Avoiding roundoff error in pg_sleep()
Дата
Msg-id CA+TgmoanvqTwQihU7ByWu+xWt8tjbUfpKV_8y=9iT09Ysw-q=w@mail.gmail.com
обсуждение исходный текст
Ответ на Avoiding roundoff error in pg_sleep()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Avoiding roundoff error in pg_sleep()
Список pgsql-hackers
On Thu, Sep 25, 2025 at 2:42 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I chanced to notice that if you ask pg_sleep for 1ms delay,
> what you actually get is 2ms, for example

Oh, wow. I tested and I get the same behavior.

> Anyway, I propose trying to get rid of this misbehavior by avoiding
> floating point in the delay computation, as attached.

Score one for my blind yet fiery hatred of floating-point arithmetic.
The patch looks good except that (places tongue firmly in cheek) it
will cause problems for users who want to sleep for more than 150,000
years.

--
Robert Haas
EDB: http://www.enterprisedb.com



В списке pgsql-hackers по дате отправления: