简体   繁体   English

主键 - UUID主键的VARBINARY或BLOB或VARCHAR

[英]Primary Key - VARBINARY or BLOB or VARCHAR for UUID primary key

I am using UUID as the primary key in one of the tables. 我使用UUID作为其中一个表的主键。
What are the pros-cons of having this field as a varchar/varbinary/blob? 将此字段用作varchar / varbinary / blob的优缺点是什么?

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. 基于文本和基于二进制的UUID之间的区别是大量字节 - 二进制表示为16,文本为30+ - 因此二进制是最佳选择。 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). 我会选择在VARBINARY BLOB -如果只因为VARBINARY是较新的类型(以及从SQL Server背景的人,我知道VARBINARY 可以存储在行)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM