I am working on an e-commerce project and encountered a problem when generating the ID. It is definitely not possible to directly use mysql's auto_increment
, because it is not safe to generate orders in this case. The third party can directly monitor the number of orders generated at a certain time through the ID. I would like to ask about websites such as segmentfault and Jianshu. I noticed that the IDs of the articles they generate are generally relatively random. In order to consider the search efficiency, they must not use random numbers. How should I generate the order ID?
Consider snowflake algorithm?
Help find one for you
Article link http://www.cnblogs.com/reluce...
Use the mysql built-in function: UUID() to generate a unique ID; also set the serial number field and use auto-increment.