konr
konr

Reputation: 2565

References and speed

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 ?persons that have :pets?

Upvotes: 1

Views: 99

Answers (1)

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91577

No, There is no speed advantage to storing both sides of a relation explicitly, all relations are bi-directional in datomic.

Upvotes: 1

Related Questions