datomic 2025-10-29

super great job shipping the excision fixes, Datomic team! that must have been a hairy one to test 😄

2

Is it correct that there is no scenario in which adding :db/index true on an attribute of type :db.type/ref can improve query performance, because queries by ref value always use VAET? Is this true even in cases where the cardinality of V is much different (higher) than the cardinality of A ?

being precise as possible: • in a datalog query • in a data pattern clause • if A and V are bound • if A is a ref VAET is always used, never AVET

that doesn't mean you can't use AVET instead, but datalog won't

e.g. [(datomic.api/datoms $ :avet ?a ?v) [[?e]]]

does that ^ work in cloud?

Thanks, Francis. "in a data pattern clause" - are there other clause types (disjunction, conjunction, rule invocation) where AVET might be used for a ref attr?

the other kinds of clauses are predicates, functions, and rules

predicates and functions can do anything you want, datalog has no insight. So in the e.g. above i'm using a function expression to call d/datoms directly so I have complete control

rules are aggregates of the other clause types, so they don't do anything on their own

so the only thing left is data pattern, which works how I said

1