Fork me on GitHub
#datomic
<
2018-07-11
>
fingertoe03:07:27

Thanks @oscar… I am making progress now..

bmaddy04:07:03

Does anyone know how to make datomic-free use more memory? I'd like to try -Xms4g -Xmx4g.

bmaddy04:07:34

I can't find anything that says what the max memory amount is for the free version, so I'm not sure it's even possible...

bmaddy04:07:27

Nevermind, I found it in the transactor script: bin/transactor -Xms4g -Xmx4g ...

euccastro06:07:43

what are the advantages of using entities with :db/ident, as opposed to keywords, for enumerations? is it only that you can assign other attributes to those entities?

euccastro06:07:19

oh and that misspelling a keyword may go unnoticed for longer. anything else?

rhansen09:07:39

I think that's about it. Since datomic isn't really a good fit for huge breaking changes to its schema, those advantages are really nice though.

Andreas Liljeqvist09:07:26

Probably a performance advantage as well

Andreas Liljeqvist09:07:15

Disadvantage is representation, :mykey vs 12312454123

bmaddy15:07:39

I'm trying to rewrite some sql in datalog. Does anyone see what I'm doing wrong here?

;; SELECT sub_type, AVG(duration) AS "Average Duration"
  ;; FROM trips
  ;; GROUP BY sub_type;
  (d/q '[:find [?st (avg ?d)]
         :with ?st
         :where
         [?e :trip/sub-type ?st]
         [?e :trip/duration ?d]]
       (d/db conn))
I get ArrayIndexOutOfBoundsException [trace missing]

chrisblom15:07:23

don’t wrap ?st (avg ?d) in []?

bmaddy15:07:53

Yeah, that gives the same thing. 😕

chrisblom15:07:54

drop the :with part

bmaddy15:07:48

That gives a result, but the sub-types get coalesced

(d/q '[:find [?st (avg ?d)]
       :where
       [?e :trip/sub-type ?st]
       [?e :trip/duration ?d]]
       (d/db conn))
["Casual" 3283.31254089422]
Other sub-types do exist:
(d/q '[:find [?st (avg ?d)]
       :where
       [?e :trip/sub-type ?st]
       [(= ?st "Registered")]
       [?e :trip/duration ?d]]
       (d/db conn))
["Registered" 1145.4663382594417]

chrisblom15:07:31

ah ok, you only get the first result now because in :find you wrap ?st (avg ?d) with []

chrisblom15:07:46

does it work if you remove the [...]?

bmaddy15:07:10

Hmm, I'm not seeing a ... to remove. Thanks a ton for taking a look at this, btw.

chrisblom15:07:33

ah, i meant your query should look like this:

chrisblom15:07:58

(d/q '[:find ?st (avg ?d)
       :where
       [?e :trip/sub-type ?st]
       [?e :trip/duration ?d]]
       (d/db conn))

bmaddy15:07:39

Ah! So I only need :with if the relvar I'm grouping on isn't included in the :find clause I bet! That totally fixed it!

bmaddy16:07:00

Thanks a ton @chrisblom!

chrisblom16:07:07

yeah, usage of :with is a bit tricky

chrisblom16:07:17

the error message does not help much

bmaddy16:07:53

Yeah. I tend to get bewildered by find-specifications also, so I think that contributed.

miridius22:07:04

Awesome! Minor issue: in the metrics section (https://docs.datomic.com/cloud/ions/ions-monitoring.html#metrics) the list of required keys includes "type", but in the example code it uses "units" instead.

miridius22:07:20

also the whole monitoring document is repeated twice (it starts over at https://docs.datomic.com/cloud/ions/ions-monitoring.html#sec-9)

jaret13:07:39

Thanks for catching that the merging of doc branches somehow duplicated the page. I’ve fixed it.