简体   繁体   English

为什么InnoDb不支持集群主键中的auto_increment

[英]Why InnoDb dont support auto_increment in clustered primary key

why innodb, doesn't support this option, and what to do instead. 为什么innodb不支持该选项,而应该怎么做。 if i have a invoice and want sorted invoice detail entry number, how to get it without clustered primary key autoincrement. 如果我有发票,并且想要排序的发票明细条目编号,如何在没有群集主键自动递增的情况下获取它。

Because it would require communication between nodes every time when you are inserting a new record, and that is expensive. 因为每次插入新记录时都需要在节点之间进行通信,所以这很昂贵。 You can use random values as IDs instead. 您可以使用随机值作为ID。 Eg: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 + http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_uuid 例如: https : //en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 + http://dev.mysql.com/doc/refman/5.7/zh-CN/miscellaneous-functions.html#function_uuid

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

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