Fork me on GitHub

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.


So ['a 'b 'c] where 'b is bound to :test does not work, but ['a :test 'c] works.


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:


I am not sure a general decorator could be made but I might be able to construct some convenience functions that will make it quite easy to do. Thanks for your input, it is much appreciated.

🙏 3