Fork me on GitHub
#datomic
<
2017-06-27
>
matthavener02:06:29

hmaurer: (imho) perf tests for DBs are notoriously bad at providing real information because so many factors are at play in DB usage

souenzzo03:06:14

how to query [:find ?u :where [?u :user/games ?g] [?g :game/finish? true]], but I want just users that have more then 5 games Finished?

robert-stuttaford04:06:22

@souenzzo have you tried adding clauses [(count ?g) ?gc] [(< 5 ?gc)] ?

souenzzo13:06:45

robert-stuttaford: [:find ?u ?gc :where [?u :user/games ?g] [?g :game/finish? true] [(count ?g) ?gc]] => UnsupportedOperationException count not supported on this type: Long clojure.lang.RT.countFrom (RT.java:646)

isaac06:06:45

What will caused :db.error/transactor-unavailable?

Galaux09:06:47

@marshall it seems my performance issue is fixed by this rewrite of my :find method. Instead of a :find+`pull` I do :find+`:find`

Galaux09:06:14

I have sthing around 2ms median for min queries

hmaurer09:06:37

@matthewdaniel I get that and completely agree, but does it warrant forbidding people from doing it in the T&Cs?

hmaurer12:06:15

Oops, yes, sorry

matthavener14:06:32

shrug its much easier to forbidden someone from doing X then forbid them from doing X “badly” 😄

dm314:06:05

what’s the best way to get the datoms transacted in the transaction I have a ref to within a db function?

dm314:06:12

should I get the database as-of (:db/txInstant tx) and query from there?

marshall15:06:33

@dm3 the transaction id is the entity ID of that reified transaction You can use the log API (specifically the tx-data function) with that entity ID to get all the datoms: http://docs.datomic.com/log.html#sec-2

marshall15:06:38

see the last example there ^

marshall15:06:13

if you prefer not to use query, you can also do it from the log API directly

souenzzo12:06:42

marshall: How to get all transactions between 2 db's? My scenario:

(let [db-before @(d/sync conn)
      result (response-for pedestal-integration-test)
      db-after @(d/sync conn)]
)

marshall12:06:17

you could do a tx-range using the basis t from the two databases (before & after)

souenzzo12:06:54

(let [_ @(d/transact conn [{:user/name "should not see"}])
      before @(d/sync conn)
      _ @(d/transact conn [{:user/name "should see"}])
      after @(d/sync conn)]
  (d/tx-range (d/log conn) (d/next-t before) (d/next-t after)))
Using basis-t, I get just the unwanted tx. With next-t works!

hmaurer16:06:52

I assume it is a common/best practice not to rely on Datomic’s internal entity ID’s and instead add an “uuid” attribute?

dm317:06:38

@marshall for the log I have to access connection from db tx fn, right?

marshall17:06:53

@dm3 not sure i follow the question

hmaurer18:06:23

@marshall sorry, I’ve got another question. How do peers obtain the connection details to the underlying storage? From the transactor?

marshall18:06:42

the URI is the address of storage; they get connection details to the active transactor from storage

hmaurer18:06:24

Oh I see. I had only used the “dev” storage, thus the confusion