Fork me on GitHub
#datalog
<
2023-02-07
>
stopa21:02:55

Hey team, noob datalog question: How would I go about querying for something like SELECT name FROM entities WHERE id IN (1, 2, 3) Would it be something like:

[:find ?n :where [?e :name ?n] [(contains? #{1 2 3} ?e)]]

refset21:02:05

Hey, using contains? as a predicate like this will almost certainly result in a full database scan. You probably want to be using :in instead

stopa21:02:29

Ah! I see -- took a look at xtdb docs and found:

{:find [e]
 :in [[first-name ...]]
 :where [[e :name first-name]]}
Thank you @U899JBRPF!

🙏 4