Fork me on GitHub
#datomic
<
2020-01-18
>
john-shaffer18:01:47

Is there a good option for local testing that's compatible with Datomic Cloud, or do you pretty much have to set up a deployment?

kenny23:01:02

We wrote this to solve that problem and have been using it for a year or so. https://github.com/ComputeSoftware/datomic-client-memdb It’d be great for the Datomic team to have an official, feature-complete version though.

👍 4
john-shaffer15:01:01

Thanks! That looks great.

dazld22:01:10

the documentation on the datoms API is a little terse - I get that there’s ways to slice the returned collection via offset, limit, and to provide values that bookend the returned data, but some examples would be great!

dazld22:01:35

links would be really welcome if you know of any

dazld22:01:13

See namespace doc for timeout, offset/limit, and error handling. - where is the namespace doc..? the doc string doesnt seem to help much.

favila22:01:24

The “namespace doc” is the docstring on the namespace itself

dazld22:01:32

that example on index-range doesn’t work for me, probably an old verison of the api

dazld22:01:44

putting ordered args instead of the map did though!

dazld22:01:02

@U09R86PA4 ah, ok - there’s no info on offset/limit in there

dazld22:01:23

(->> (d/index-range
       (ldb)
       :user/email
       "d"
       "e")
     (map :v))

dazld22:01:26

this worked for me

dazld23:01:31

annoyingly the map version throws an arity exception, as well as anything apart from arity 4

dazld23:01:34

that looks like a bug

dazld23:01:51

have to put nils in the slots

favila00:01:12

Call it with a map arg

favila00:01:25

I didn’t think you could call it like this

dazld09:01:52

I can’t call it any other way.

dazld09:01:57

(d/index-range (ldb) {})
Execution error (ArityException) at user/eval28846 (form-init4749596070973050853.clj:1).
Wrong number of args (2) passed to: datomic.api/index-range
(d/index-range {})
Execution error (ArityException) at user/eval28850 (form-init4749596070973050853.clj:1).
Wrong number of args (1) passed to: datomic.api/index-range
(d/index-range (ldb) {})
Execution error (ArityException) at user/eval28854 (form-init4749596070973050853.clj:1).
Wrong number of args (2) passed to: datomic.api/index-range
(d/index-range (ldb) {} {})
Execution error (ArityException) at user/eval28858 (form-init4749596070973050853.clj:1).
Wrong number of args (3) passed to: datomic.api/index-range
(d/index-range (ldb) :attrid :user/email :start "d" :end "e") 
Execution error (ArityException) at user/eval28862 (form-init4749596070973050853.clj:1).
Wrong number of args (7) passed to: datomic.api/index-range
(d/index-range (ldb) :attrid :user/email :start "d" ) 
Execution error (ArityException) at user/eval28866 (form-init4749596070973050853.clj:1).
Wrong number of args (5) passed to: datomic.api/index-range

dazld09:01:59

same on

(d/datoms (ldb) :avet :user/email)

dazld09:01:06

:man-shrugging:

dazld09:01:20

bit of a mystery

dazld09:01:46

datomic-free `

0.9.5697
`

favila21:01:45

No mystery. You are not using datomic cloud but datomic on-prem

favila21:01:49

It has a blocking api and is in-process. It has no concept of timeout, offset, limit etc which belong to the peer api

favila21:01:38

So you are actually reading the wrong docs

favila21:01:05

Oh and I missed that you were taking about index-range later

favila21:01:39

Index-range is not variadic; datoms and seek-datoms are

dazld14:01:55

sorry, yes was playing with both APIs

dazld14:01:23

still, I think the docs could use some love - I’m interested in on-prem performance, and they look critical to this

favila14:01:11

Generally you should lean on queries. I’ve only found datoms useful when the intermediate or final sets from datoms are too large for peer memory

favila14:01:45

Even then the strategy is usually to use datoms to get chunks to feed as input to the “full” query

favila14:01:29

I guess one other case is certain kinds of self-joins

dazld14:01:31

I’m sorting a list of 8000 items by counting the number of items each has on a ref attribute

dazld14:01:39

I can’t seem to get it under 800ms

dazld14:01:59

using a materialized count gets it down to about 140ms, but still…

dazld14:01:21

I’ll probably open a topic on the forum

dazld14:01:57

if the answer is “use materialized counts and tx functions” then that’s also ok.

dazld14:01:55

(total number of ref’d entities is about 200k, so not particularly big lists..)

favila08:01:29

Start a new thread showing your queries

favila08:01:27

Also how much memory do your peers have? More memory -> more cached data -> faster

dazld09:01:18

i’ll write a thread