paralleldrive/cuid2

Can you Guide me which MySQL Data Type we should use for CUID

IamManchanda opened this issue · 2 comments

Not sure whether this is right place to query this "so apologies" but can you Guide me which MySQL Data Type we should use for CUID? I mean what do you recommend?

https://www.w3schools.com/mysql/mysql_datatypes.asp

CHAR(24) is a good default if you're using default settings (recommended).

You can use the binary options as well, but you'll need to do the translations from and to binary when you use the ids in your text data. Math for how to calculate bits is log2(36^(24)) where n is the number of characters you're using (defaults to 24). With default settings, that will be 125 bits. (You can squeeze it into 124 if you isolate bit conversion for the first char). Binary is generally not worth the extra development effort using modern hardware systems.

Thanks sir for clarifications @ericelliott ... thanks a lot, helps me :)