Closed shwetasynoverge closed 5 years ago
We've used KSUIDs as primary keys in MySQL database, ether using their base62 representation or their binary format. The column type should be varbinary(27)
or varbinary(20)
depending on the approach you take. The advantage of using the base62 representation is it enables copy/pasting values when composing queries manually.
Let me know if that helps answer your question.
Thanks for your prompt reply. And can you please explain me that how indexing for ksuid works in MySQL?
Also one more question : Is it possible to generate KSUID directly through MYSQL ? like for example we have "SELECT UUID()" ?
It'll work just like indexing other byte sequences, a lexicographic comparison will work just fine with KSUID (in both base62 and binary representations).
I'm not aware of any MySQL function that generate a KSUID, we generate them client-side when constructing queries.
Thanks a lot
I want to know how we can use KSUID with MySQL ? Also if yes how indexing would work