Re: Microsecond-based timeouts

From: Andres Freund <andres(at)anarazel(dot)de>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Microsecond-based timeouts
Date: 2023-03-13 21:59:19
Message-ID: 20230313215919.vqcjb3obgktroyxy@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-03-13 18:23:02 +1300, Thomas Munro wrote:
> One question is whether it'd be better to use nanoseconds instead,
> since the relevant high-resolution primitives use those under the
> covers (struct timespec). On the other hand, microseconds are a good
> match for our TimestampTz which is the ultimate source of many of our
> timeout decisions.

It's hard to believe we'll need nanosecond sleeps anytime soon, given that
even very trivial syscalls take on the order of 100ns.

It's not like we couldn't add another function for waiting for nanoseconds at
a later point.

> I suppose we could also consider an interface with an absolute timeout
> instead, and then stop thinking about the units so much.

That seesm pretty awful to use, and we'd just end up with the same question at
the callsites.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-03-13 22:20:08 Re: windows CI failing PMSignalState->PMChildFlags[slot] == PM_CHILD_ASSIGNED
Previous Message Regina Obe 2023-03-13 21:57:57 RE: Ability to reference other extensions by schema in extension scripts