Fork me on GitHub

Jo what happens when I add :db/index true to an attribute with cardinality many? Does it make an index for each single value or for each "composite" value if that makes sense ?


The use case is I have a product lookup with a key called "model". Each product can have many models. Also I would like to lookup the data via the models.


The indexes for Datahike are the same as they are for Datomic, afaik. Each datom is indexed by default in the eavt- and the aevt-index, that makes lookups by entities or attributes super fast.


:thumbsup: I was wondering about AVET when I have a :db/index attribute that is also "many". I guess the lookup is fast for all values? Let's say I have a product with model names (many strings).


The avet-index looks something like this:

:attribute1 "foo" 12345 time
:attribute1 "bar" 12346 time
:attribute2 "baz" 12347 time
It's a bit like a postgres-index that is generated over multiple columns.