3 ms·
Life Altering PostgreSQL Patterns
- bearjaws 2y agoYou 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
- catlover76 2y ago[dead]
- deleted 2y ago[deleted]
- jasonthorsness 2y agoThe concept of system_id for marking special rows was interesting, I haven't seen it described in quite that way.