4 ms·
And you can use it today with Postgres uuid type. Postgres doesn’t care what you store in it as long as it has the correct length. So you can generate a uuidv7
by pyrolistical 3y ago
And you can use it today with Postgres uuid type. Postgres doesn’t care what you store in it as long as it has the correct length. So you can generate a uuidv7 and store it natively
- jolux 3y agoWouldn’t the index types need to be updated to support ordering on UUIDs?
- perfmode 3y agoWhat are the benefits of using the Postgres uuid type (versus using TEXT or VARCHAR)?
- jvolkman 3y agoIt's 16 bytes versus 36 bytes.
- netcraft 3y agototally tangential to this but just have to share learned this last week that md5's are also 128 bits and so will fit perfectly in a uuid type in postgres, saving space in the physical table and indexes, and giving better index performance. So if youre storing md5 hashes, use UUID!
- thangngoc89 3y agoIt’s stored in binary format (16 bytes) instead of text (36 bytes)
- gabereiser 3y agoStored in binary format, validation, more efficient due to non-cast, faster access due to non char*, being able to split the high-low, indexing and uniqueness at the byte level.
- dbbk 3y agoWhat validation? "Postgres doesn’t care what you store in it as long as it has the correct length."
- gabereiser 3y agoI mean, if(len(O) == 32) technically is a validation but you’re right, by default it just fits for size.
- hardwaresofton 3y agoYup this is one of the reasons I put together a light extension for this: https://github.com/VADOSWARE/pg_idkit https://github.com/VADOSWARE/pg_idkit There are a lot of options for UUID extensions (lots of great pure SQL ones!), but I wanted to get as many ID generation strategies in one place Also note that native UUID v7 is slated to land in pg17: https://commitfest.postgresql.org/44/4388/ https://commitfest.postgresql.org/44/4388/