Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primary Key - VARBINARY or BLOB or VARCHAR for UUID primary key

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?

like image 971
Swati Avatar asked Oct 28 '25 08:10

Swati


1 Answers

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).

like image 73
Will A Avatar answered Oct 29 '25 22:10

Will A



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!