开发者

Binary vs Integer - as primary key?

开发者 https://www.devze.com 2023-01-22 12:05 出处:网络
I was wondering if there are any obvious pros and cons one should be aware about, while choosing to use a Binary type as a primary key, while being RA开发者_运维问答NDOMIZED.

I was wondering if there are any obvious pros and cons one should be aware about, while choosing to use a Binary type as a primary key, while being RA开发者_运维问答NDOMIZED.

Which means, new inserts will have random 4 bytes as their PK - versus having a sequence of type Integer?

I'm using MySQL/MyISAM.

Thanks, Doori Bar


If the primary key isn't sequential then insert performance for a clustered index will not be very good. It has to rearrange the index for almost every insert.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号