How to generate unique alphanumeric content in MySQL?
Say, va开发者_运维技巧lues would be 1000-characters long.
Are you sure you don't just want to use UUIDs? They're only 32 chars long, but there are near infinite combinations.
You could use a 64-bit integer field as backing and then convert to base 36, putting as many leading 0's as are needed in order to pad to your target number of characters (1,000 in this case).
concat(md5(rand()), md5(rand()), ...)
should do the trick without much fuss.
精彩评论