I am using UUID as the primary key in one of the tables.
What are the pros-cons of having this field as a varchar/varbinary/blob?
Asked
Active
Viewed 2,837 times
3

Swati
- 41
- 1
- 3
-
In fact, are you sure you want to use UUID as the primary key? If you are using InnoDB, it is a poor choice for performance due to the nature of clustered index. – tszming Aug 12 '10 at 06:50
-
Yes, UUID is the way to go for this table. – Swati Aug 12 '10 at 08:08
1 Answers
5
The difference between text-based and binary-based UUID is a significant number of bytes - 16 for binary representation vs. 30+ for text - so binary is the way to go. I would opt for VARBINARY over BLOB - if only 'cause VARBINARY is the newer type (and coming from a SQL Server background, I know VARBINARY there can be stored in-row).

Will A
- 24,780
- 5
- 50
- 61
-
-
-
The size of the UUIDs in binary format will always take 16 bytes, so it's better to use `BINARY(16)` than `VARBINARY(16)`. – elderapo Nov 02 '22 at 12:25