This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-29
Channels
- # announcements (10)
- # babashka (18)
- # beginners (136)
- # calva (9)
- # cider (14)
- # clara (12)
- # clj-kondo (32)
- # cljsrn (3)
- # clojure (133)
- # clojure-europe (21)
- # clojure-nl (4)
- # clojure-uk (15)
- # clojurescript (60)
- # conjure (40)
- # cursive (12)
- # datomic (6)
- # emacs (2)
- # fulcro (19)
- # jackdaw (25)
- # jobs-discuss (3)
- # kaocha (3)
- # leiningen (5)
- # off-topic (99)
- # pedestal (1)
- # re-frame (49)
- # reagent (4)
- # ring (5)
- # rum (5)
- # shadow-cljs (53)
- # spacemacs (2)
- # sql (13)
- # timbre (2)
- # tools-deps (23)
- # vim (11)
- # xtdb (7)
Is there a particular reason why a a query clause with all variables would not work? If I change the attribute to the value of the variable in its place it works fine.
Hi 🙂 This is because attributes cannot be expressed via logic variables by design. It is a consequence of keeping the query engine as low-complexity as possible whilst generating predictable and efficient query plans.
Can you tell me more about why you need variable attributes? Is it something you could still potentially solve with a post-walk
before submitting the query?
Well I can split the query in two and pass in the attribute as a parameter, but it feels clunky.
The reason I need it is that the attribute is a value in another document I am querying for.
ah right, yes I don't think that can be avoided. I think a two-step process is somewhat necessary when you are essentially persisting your schema into Crux as well. We have to do this for our SQL module also. Thankfully there are caches you can use as well open-db
, to eliminate some of the hit.
Ultimately I don't think having everything in one query could be any more efficient under the hood anyway (even with a more sophisticated planner) as you'd still be making the same number of KV seeks, which is where the real time-costs are. Perhaps you can create some kind of generalised 2-step decorator for your requirements that wraps our APIs :thinking_face: