Fork me on GitHub
#datalevin
<
2023-02-26
>
joshcho04:02:58

What's the best way to create multi-column index in datalevin?

joshcho04:02:15

So if you add a tuple element that is not unique, will that be indexed?

Huahai04:02:54

What are trying to do?

joshcho04:02:36

I have a schema like

(def schema {:edge/et {:db/valueType :db.type/ref
                       :db/cardinality :db.cardinality/one
                       :db/index true}
             :edge/from {:db/valueType :db.type/ref
                         :db/cardinality :db.cardinality/one
                         :db/index true}
             :edge/to {:db/valueType :db.type/ref
                       :db/cardinality :db.cardinality/one
                       :db/index true}})

joshcho04:02:52

I'd like the queries over et & from or et& to to be fast

joshcho04:02:20

My current solution has been

:edge/et+from {:db/valueType :db.type/tuple
                            :db/tupleAttrs [:edge/et :edge/from]
                            :db/cardinality :db.cardinality/one}

joshcho04:02:28

But wondering if there is something else

Huahai04:02:46

Looks good to me

👍 2