What if I need a very very big autoincrement ID?

一笑奈何 提交于 2019-12-17 18:51:32

问题


According to the MySQL website, the signed bigint can go up to 18446744073709551615. What if I need a number bigger than that for the auto-incrementing primary key?


回答1:


If you insert 1 million records per second 24x7, it will take 584542 years to reach the limit.

I hope by then a next version of MySQL will support bigger ID columns, and developers will all be able to do back-of-the-envelope calculations before posting to Stack Overflow :)




回答2:


With such a number (1 to 18446744073709551615), you can give all the animals on the earth a unique ID :)




回答3:


I suppose you're screwed? You could get rid of MySQL's auto increment and could use a base 64 number you increment yourself.



来源:https://stackoverflow.com/questions/5762327/what-if-i-need-a-very-very-big-autoincrement-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!