4 ms·
You should never use a truly random UUID for an indexed column like the primary key. The clustering of the random values makes for terrible indexes, you should
by bearjaws 2y ago
You should never use a truly random UUID for an indexed column like the primary key.
The clustering of the random values makes for terrible indexes, you should use something like uuid_generate_v7();
This has the added benefit of being able to get the timestamp out of the primary key e.g.
SELECT uuid_v7_to_timestamptz('018570bb-4a7d-7c7e-8df4-6d47afd8c8fc');
uuid_v7_to_timestamptz
----------------------------
2023-01-02 04:26:40.637+00