Is there a way to query for which entities/attributes refer to a particular value in xtdb? In datomic I can do something like this to find the entities and attributes that refer to :some/id :
(d/q '[:find ?entity ?attr-ident
:where [?entity ?attr :some/id]
[?attr :db/ident ?attr-ident]
db)
I'm wondering if this kind of thing is possible in xtdb?hey @esp1, afraid not, this isn't an index we keep - we expect the attributes to be statically known
ok, thanks for the info -
well, in v1 you can do this https://gist.github.com/refset/93135adcbf41fccab9b641638ab10997 and in v2 you can do something similar using the information_schema tables, but it inevitably requires two queries (same as most SQL databases, without dropping down to some procedural dialect)
Thanks @taylor.jeremydavid - if I understand this correctly, first you query for all known attributes, and then query for any relation where one of these attributes has the target value?
yep that's right 🙂