Home > Software design >  Which is the best datatype to store UUIDs in PostgreSQL?
Which is the best datatype to store UUIDs in PostgreSQL?

Time:10-30

I am trying to store UUIDs in a posts table (posts - social media like it doesn't matter), and I would like to know which is the correct way to store UUIDs in PostgreSQL. I have tried to convert them into bytes and store them into binary(16) datatype columns in MySQL. But I cannot find a similar type in PostgreSQL such as binary(16) I found only bytea. So I need a datatype that will help with the size of the column. Is there anything like bytea var-sized?

CodePudding user response:

Use the dedicated uuid datatype. Not bytes or bits.

  • Related