Fork me on GitHub
#datomic
<
2015-11-08
>
gurdas04:11:36

Anyone have any recommended techniques for troubleshooting non-performant datalog queries?

gurdas04:11:26

I've used a lot of the common practices of starting with the most restrictive where clauses, but am seeing some issues when "joins" are in effect

bkamphaus04:11:48

@gurdas: If you share a copy of the query (or an analogous query against a toy schema or something like https://github.com/Datomic/mbrainz-sample ) I can take a look tomorrow or Monday (not staying on much longer tonight).

bkamphaus04:11:31

(of course, someone else might be able to help in the mean time)

bkamphaus04:11:16

are you using any comparison predicates on unindexed attributes (or on a version of Datomic prior to avet optimizations w/comparison predicates in query), or log or history database values in the query?

gurdas04:11:17

Thanks @bkamphaus , It's basically an OLAP style reporting db, that has a few hierarchical "dimensions" that slice/aggregate a lot of individual facts. For instance in this query the dimensions are known as "trees", and the nodes have on the order of a few thousand "lines" of financial data that needs to be aggregated up to them; a query for retrieving a count of all lines in a tree would look like this (this executes in ~60ms against 100k+ lines, and around 600 nodes)

[:find (count ?l)
                :where
                [?t :tree/id "someid"]
                [?n :node/tree ?t]
                [?l :line/nodes ?n]]

gurdas04:11:41

Lines are grouped into datasets too, so when I try to group the resulting lines by dataset (to get line count by dataset):

[:find ?ds (count ?l)
                :where
                [?t :tree/id "someid"]
                [?n :node/tree ?t]
                [?l :line/nodes ?n]
                [?l :line/dataset ?ds]]
Query time shoots up to ~300 ms

gurdas04:11:11

May help if I share the schema?

nha21:11:57

Hello, I am following the datomic tutorial, trying to start the console and I get :

āžœ  datomic-pro-0.9.5327  bin/console -p 8080 dev datomic:     
Exception in thread "main" java.lang.IllegalAccessError: tried to access method clojure.lang.RT.classForNameNonLoading(Ljava/lang/String;)Ljava/lang/Class; from class datomic.console.error$loading__5340__auto____1

What could it be ?

nha21:11:35

I started the transactor in another console :

āžœ  datomic-pro-0.9.5327  bin/transactor config/samples/dev-transactor-template.properties 
Launching with Java options -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=50
Starting datomic:, storing data in: data ...
System started datomic:, storing data in: data
`

alwaysbcoding21:11:19

it's a bug with version 0.9.5327 of Datomic

alwaysbcoding21:11:58

If you're just trying out the datomic tutorial I would recommend just downloading version 0.9.5302 and using that

alwaysbcoding21:11:28

or else I think you can download a working version of the console in isolation and run it against version 0.9.5327

nha21:11:45

Oh I see

nha21:11:13

Is it something usual ? I mean, how stable is datomic ?

alwaysbcoding21:11:58

for the most part it's pretty stable. I don't really use the console so can't say for sure whether or not there's usually bugs with it

nha21:11:11

Ok thanks, I am just getting my feet wet with datomic. I'm sold on the general idea of course simple_smile

alwaysbcoding21:11:08

haha yup, welcome to Clojure. Works great in conference talks, a little trickier in the real world.

nha21:11:51

aha yes I spent quite a few hours making a nice setup, and looks like the foundations of my app will take a little time too simple_smile

nha21:11:28

But this is fun, and the community is really nice and going in a good direction so.. pretty cool simple_smile

nha21:11:12

ok it works with the previous version, thank you