Fork me on GitHub
#datahike
<
2022-06-19
>
Benjamin18:06:43

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 ?

Benjamin19:06:44

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.

timo07:06:28

The indexes for Datahike are the same as they are for Datomic, afaik. https://docs.datomic.com/on-prem/query/indexes.html Each datom is indexed by default in the eavt- and the aevt-index, that makes lookups by entities or attributes super fast.

Benjamin07:06:48

: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).

timo10:06:12

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.