Re: What is a typical precision of gettimeofday()?

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Subject: Re: What is a typical precision of gettimeofday()?
Date: 2024-03-20 06:35:22
Message-ID: 78ae7f2b-7963-4167-b2d2-d66d2ee17091@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19.03.24 10:38, Aleksander Alekseev wrote:
> Considering the number of environments PostgreSQL can run in (OS +
> hardware + virtualization technologies) and the fact that
> hardware/software changes I doubt that it's realistic to expect any
> particular guarantees from gettimeofday() in the general case.

If we want to be robust without any guarantees from gettimeofday(), then
arguably gettimeofday() is not the right underlying function to use for
UUIDv7. I'm not arguing that, I think we can assume some reasonable
baseline for what gettimeofday() produces. But it would be good to get
some information about what that might be.

Btw., here is util-linux saying

/* Assume that the gettimeofday() has microsecond granularity */

https://github.com/util-linux/util-linux/blob/master/libuuid/src/gen_uuid.c#L232

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2024-03-20 06:48:10 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message Shlok Kyal 2024-03-20 06:14:24 Re: speed up a logical replica setup