4 ms·
What are the benefits of using the Postgres uuid type (versus using TEXT or VARCHAR)?
by perfmode 3y ago
What 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.