This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-10
Channels
- # announcements (3)
- # babashka (16)
- # beginners (41)
- # biff (4)
- # calva (14)
- # circleci (1)
- # clj-http (24)
- # clj-kondo (9)
- # clj-on-windows (31)
- # cljs-dev (52)
- # clojure (162)
- # clojure-australia (10)
- # clojure-europe (52)
- # clojure-nl (2)
- # clojure-spec (1)
- # clojure-uk (5)
- # clojurescript (40)
- # conjure (6)
- # core-async (3)
- # cursive (5)
- # datalevin (11)
- # datomic (7)
- # emacs (12)
- # etaoin (19)
- # events (1)
- # figwheel-main (17)
- # fulcro (4)
- # graalvm (3)
- # gratitude (13)
- # honeysql (8)
- # introduce-yourself (7)
- # london-clojurians (1)
- # off-topic (9)
- # polylith (9)
- # rdf (1)
- # re-frame (21)
- # releases (5)
- # remote-jobs (4)
- # sci (28)
- # shadow-cljs (15)
- # spacemacs (2)
- # vim (4)
- # xtdb (15)
Is there a good way to filter based on an attribute if I don't save it? Or is it better to store a false
value instead?
I have a boolean attribute in DB which I don't save but when I set it to true
I add it.
Is it better to save false
or is there a good way to obtain it with one query? I expect to have many entries there.
Nice. I'll try it, thanks!
it is documented as the replacement for missing?
https://docs.xtdb.com/language-reference/datalog-queries/#datascript-differences
> Or is it better to store a false
value instead?
Queries will generally be much faster if you store explicit false
/`nil` values and search for those, rather than the absence of an attribute, but whether it's significant for your application greatly depends on the relative cardinalities involved
could a native missing?
implementation be made that is faster than the suggested not-join workaround?
A native missing?
would probably help a little, as subqueries like not-join
aren't free, but it still wouldn't be able to get close to the speed of storing the explicit null values
Hm. So what is better then? Storing nil
or storing false
?
Should the query check via predicate funcion in that case?
[(nil? :my-attr)]
?
[(false? :my-attr)]
?
I don't know how it's wired but those three could either be equivalent or EAV best for performance...? It's my guess.
The EAV pattern should be fastest there.
I would personally try storing false
or perhaps even a domain-specific keyword sentinel like :my.orders/no-shipping-date-specified
as using nil
might get confusing. Although a keyword will inevitably use more disk space
The value that I'll have is something that I calculate for each entry and it's always a boolean. And I know that I shouldn't need anything else there (it won't become an enum/kw). So no worries 😄