使用 timeuuid 作为唯一的用户标识或令牌

using timeuuid as unique userid or token

我已经阅读了一些关于生成用户 ID 的旧答案。您知道使用 timeuuid 作为唯一标识符是否安全吗?我计划将它用于用户 ID 和令牌。

谢谢 问候

UUID 和 timeUUID 可以安全地用作唯一键。 Documentation对UUID类型的描述如下:

The UUID (universally unique id) comparator type is used to avoid collisions in column names. Alternatively, you can use the timeuuid.

有关 UUID 如何工作的更多信息,Wikipedia article 概述了 UUID 的生成方式及其工作原理。这个问题很奇怪,因为重复的 TYPE 1 UUID 的几率非常低。来自维基百科条目,

...after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%.

这适用于 timeUUID。