3 ms·
And https://github.com/rs/xid https://github.com/rs/xid What would be more interesting to me is a benchmark of how would using those as priary keys on Postgres
by swah 8y ago
And https://github.com/rs/xid https://github.com/rs/xid
What would be more interesting to me is a benchmark of how would using those as priary keys on Postgres would affect performance.
- wvh 8y agoIf the libraries produce 128-bit values, then they could use Postgresql's UUID type. In fact, Postgresql should accept anything as a UUID in text mode as long as the value is in hex with a length of either 32 or 36 (32 + 4 dashes), though using binary mode would probably be faster if the UUID library and your driver support that. We've been using sortable epoch-based UUIDs as primary key for two different software products, storing them in Postgresql with the builtin UUID type, utilising binary mode. Performance is good.
- swah 8y agoYeah - xid, ksuid are all smaller than that. Maybe I could pad with zeros and use the UUID type?