This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-19
Channels
- # announcements (5)
- # asami (7)
- # aws (10)
- # babashka (10)
- # beginners (49)
- # calva (12)
- # cider (5)
- # circleci (1)
- # clj-kondo (25)
- # clj-yaml (14)
- # clojars (5)
- # clojure (134)
- # clojure-europe (142)
- # clojure-france (3)
- # clojure-nl (1)
- # clojure-norway (4)
- # clojurescript (10)
- # cursive (8)
- # datomic (19)
- # emacs (11)
- # fulcro (8)
- # graalvm (29)
- # honeysql (7)
- # jobs (4)
- # jobs-discuss (9)
- # lsp (196)
- # obb (4)
- # off-topic (40)
- # pathom (4)
- # releases (4)
- # remote-jobs (3)
- # shadow-cljs (16)
- # sql (25)
- # squint (2)
- # tools-deps (12)
- # xtdb (7)
- # yada (4)
I was going to use https://github.com/zelark/nano-id, which uses string ids. @taylor.jeremydavid https://clojurians.slack.com/archives/CG3AM2F7V/p1663192655830849?thread_ts=1663191223.983299&cid=CG3AM2F7V this: > Don't use stringified UUIDs though, as actual UUIDS will be much more efficient. Can we elaborate on the above statement? Why are they more efficient? Is the statement always true (e.g. even if I use string ids say 10 chars long)?
My educated guess would be as https://github.com/ptaoussanis/nippy is used to serialize docs, it has specialization for Date and UUIDs: https://github.com/ptaoussanis/nippy/pull/27
Hey @U02E9K53C9L UUIDs are encoded and handled as 16-bytes total, via Nippy (plus a 1-byte prefix), whereas UTF-8 strings are between 1-4 bytes per char See also https://clojurians.slack.com/archives/CG3AM2F7V/p1649170454387559?thread_ts=1649169824.672809&cid=CG3AM2F7V 🙂 And for codec reference (e.g. Dates are mostly handled natively, not via Nippy): https://github.com/xtdb/xtdb/blob/ae34fd5b27aa33ea914df6bc4ab52c3e3d853c19/core/src/xtdb/codec.clj#L82-L100
Thank you to the both of you! I'm sorry to say that I'm still not sure exactly what "efficient" means here. Are UUIDs just using less disk space? Or will db reads be faster when using UUIDs too? I'm wanting URL-friendly ids (both alphabet-wise and length-wise), and I feel completely out of my depth evaluating the trade-offs here.
> Are UUIDs just using less disk space? Or will db reads be faster when using UUIDs too? These two are fairly entwined. Fewer bytes means: less I/O, faster byte-wise comparisons during index traversals, better caching density etc.