Are references bi-directional, in the sense that given ?cat
, datomic does no searching to find the related entity, ?person
, in a [?person :pet ?cat]
restriction?
Or should I manually build a reference in the other side (e.g. setting an :owner
attribute for pets) to prevent a linear search in all the ?person
s that have :pet
s?
No, There is no speed advantage to storing both sides of a relation explicitly, all relations are bi-directional in datomic.