Fork me on GitHub
#datomic
<
2016-03-30
>
casperc13:03:07

When doing a large import, is it recommended to leave off the indexes and then add them later?

Ben Kamphaus13:03:06

@casperc: recommended is maybe strongly stated, but it’s definitely something that makes sense to do if indexing is a bottleneck for the import. If you haven’t might be helpful to review the [import docs](http://docs.datomic.com/capacity.html#data-imports) for other ideas.

casperc13:03:31

I did check them out, but I can’t e.g. do batching, since I am adding data to the transaction.

casperc13:03:40

@bkamphaus: How can I tell if the indexing is the bottleneck? I only have the logs to go by for now

casperc13:03:16

Is the AlarmBackPressure metric logged as well?

Ben Kamphaus14:03:03

@casperc: yes, any AlarmBackPressure in the logs will indicate transactions are pushed back waiting on indexing.

biggert16:03:09

I have a question about a way I’m trying to write a datalog query where I’m using a collection binding and negation. Long story short, I want the entire list of attributes that are components except for a select few. My query looks like this:

biggert16:03:17

[:find [?name ...]
         :in $ ?e [?skip ...]
         :where
         [?e ?a ?v]
         [?a :db/ident ?name]
         [?a :db/isComponent true]
         (not [?a :db/ident ?skip])]

biggert16:03:04

So if I pass in my entity-id and a list that contains only one attribute that I want left out, it works. Any other variation on the list and it doesn’t work… so an empty list (saying that I want no attributes ignored) or a list with 2 or more (saying I want all of these attributes ignored).

biggert16:03:38

Does anyone know why that’s happening? I can’t explain the empty list scenario at all but the 2+ scenario seems to be doing an ‘and' instead of an ‘or'.

Ben Kamphaus16:03:53

@biggert: trying to parse through the problem. My quick reading of this query is that with 2+ it will union several subsets of relations with one thing excluded, which would be the same as the query with no exclusions (without the not clause). I.e. one thing gets excluded at a time and the results are unioned.

biggert17:03:26

Gotcha. From the queries we’ve played with and parsing the different results, I can see that being the case. I’m having difficulty coming up with a different approach in datalog to avoid that.

Ben Kamphaus17:03:27

pull ‘[*] and dissoc resulting map maybe?

biggert17:03:32

Yeah... We have another approach where instead of the ?skip we map over the query and build it dynamically adding nots for every individual attribute and it works but we'd like to do that work in datalog and avoid a dynamic query if possible.

calebp18:03:46

[:find ?e
 :in $ ?e ?atts-to-skip
 :where
 [?e ?a ?v]
 [?a :db/isComponent true]
 [?a :db/ident ?i]
 (not [(?atts-to-skip ?i)])]

calebp18:03:59

This also seems to work if you pass in the atts-to-skip as a set

calebp18:03:48

Sorry about the typo in the find clause. Obviously not looking for ?E

Ben Kamphaus18:03:55

yes, you can pass a collection and invoke Clojure collection manipulation in the body of Datalog (i.e. in this case testing set membership), Not usually a solution I tend to reach for, though it may be a fit for this case. Still thinking on it a bit.