Fork me on GitHub
#datomic
<
2015-09-25
>
domkm21:09:54

I remember reading something about the maximum practical length of strings in Datomic but I can't find the discussion. What limit should I set for string length?

shofetim22:09:50

So when I use a pull in a find spec ie like

(d/q '[:find (pull ?e [* {:order/line-items
                            [* {:package/size [*]
                                :line-item/package
                                [* {:good/_packages [*]}]}]}])
        :in $ ?person-id
        :where  [?e :order/person ?person-id]]
    (get-db) person-id)
I get a vector of vectors, of the objects I wanted.... is their something more idiomatic then calling flatten ?

shofetim23:09:11

I found it

(d/q '[:find [(pull ?e [* {:order/line-items
                             [* {:package/size [*]
                                 :line-item/package
                                 [* {:good/_packages [*]}]}]}]) ...]
        :in $ ?person-id
        :where  [?e :order/person ?person-id]]
    (get-db) person-id)
Not sure what that is called, but wrapping the query in another vector unwraps the results.

shofetim23:09:42

@bkamphaus: any ideas how I could make the above query faster? or how to know what parts are expensive? I don't have much data yet and it's taking about 950 msecs (returns 24 results)

Ben Kamphaus23:09:04

is person-id a unique attr?

Ben Kamphaus23:09:19

you might bypass query altogether then and just use a lookup ref as the entity identifier in a call to the pull API directly

shofetim23:09:20

{:db/id #db/id[:db.part/db] :db/ident :order/person :db/valueType :db.type/ref :db/index true :db/cardinality :db.cardinality/one :db.install/_attribute :db.part/db}

shofetim23:09:41

k, I'll try that.