mysql - 设计一个订单表时,有了唯一的订单号,是否还需要存自增长的ID
怪我咯
怪我咯 2017-04-17 13:50:16
0
5
406

在设计一个订单表,用算法生成唯一的订单号可以保证不重复,那么是否还需要自增长的ID呢,还是直接就用订单号作为主键就可以

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(5)
Ty80

For mysql, obviously, even if you have a unique order ID, you must have a primary key that automatically increments the id.

刘奇

Mysql has high efficiency in incrementing the primary key.

Ty80

It is recommended to use physical primary key id instead of logical primary key to facilitate system expansion

Peter_Zhu

You definitely need a self-increasing ID

PHPzhong

It is recommended to retain the default id auto-increment primary key at all times
http://imysql.com/2014/09/14/mysql-faq-why-innodb-table-using-autoinc-int-as-pk .shtml

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!