Use data type uuid or varchar(36) for my UUID column?

43 Views Asked by At

I'm using PostgreSQL in my project. The primary key column in my table is a character type with length of 36. I generate guids in the backend and store them in the table. Do I need to change the column type as uuid? Can it have the same performance?

1

There are 1 best solutions below

0
Erwin Brandstetter On BEST ANSWER

Store UUIDs as data type uuid, not as varchar or text. That would require more space in RAM and on disk, be slower to process and more error prone. See: