Fork me on GitHub
#datomic
<
2015-07-27
>
kachayev07:07:30

I wonder if it’s possible to know in advanced how many segments will be fetched from storages during query execution?

kachayev07:07:30

I mean I understand that it depends on query itself, schema, data that was already fetched etc

kachayev07:07:50

Something like “select explain"

robert-stuttaford08:07:49

i saw someone had made a library to attempt to count datoms at each clause, but that was before all the new stuff was added

robert-stuttaford08:07:33

from reading the questions the author was asking and the sort of answer he was getting from Cognitect, it was directly in Datomic’s secret-sauce and no real progress was made

robert-stuttaford08:07:43

if such a facility exists, it’ll be because Cognitect provides it

robert-stuttaford09:07:58

anyone using the pull spec have a simple way to flatten the result such that all nested maps are merged with the root map?

akiel13:07:20

@kachayev: i think the best thing you can do is monitoring your storage. as far as i know, index segments have a fixed size in kilobytes. so even your data influences how many segments are needed for a query. the peer also caches all segments. so running a reasonable small query again should not reach out to the storage twice. in queries, it’s important to order the clauses by the number of datoms they bind. by having the most specific clause first, you will get the best performance.

kachayev13:07:39

the question is that it’s hard to keep track of "order the clauses by the number of datoms” when you have many queries

kachayev13:07:53

and/or dynamically built queries

kachayev13:07:39

it’s also hard to “play” with data locality - it just takes too much time to do: change schema, load everything, run a lot of queries, then analyze charts about network consumption & storage performance (and they are not that obvious usually)

robert-stuttaford13:07:14

dynamically built queries are not such a good idea. d/q caches the preparatory work it does for its first param. better to have standard queries with dynamic :in values

robert-stuttaford13:07:10

hear you on the ease of play thing. immutability does have its downsides simple_smile

robert-stuttaford13:07:32

i’ve just checked, we have 500+ invocations of d/q in our projects

robert-stuttaford13:07:41

and we’ve done ok with perf testing each one as we go

robert-stuttaford13:07:20

ordering clauses such that :in values are handled early and :find values late, and then testing swapping things around in the middle

robert-stuttaford13:07:00

on network traffic, you can stick memcached in the middle to get a big overall read perf boost

kachayev13:07:05

didn’t get the idea about “immutability” and “data locality” (in terms of “immutability downsides”). orthogonal concepts as for me

akiel14:07:59

@kachayev: right a query planner may be helpful in bigger projects - I once heard from Rich that he likes the control one have when there is no query planner. I think he was bitten by some SQL query planner in the past. If he still thinks the same and paying customers do not complain a lot, do not expect a query planner very soon.

akiel14:07:57

@kachayev: I expect data locality is also not easy to track down inside say Oracle accessing files in a SAN. Other than that there is better tooling around.

kachayev14:07:03

I can’t say that it’s a kind of “complain”, just curiosity. I understand that most modern databases don’t provide any tooling for this as well, so it’s not a “must-have” and definitely not a “deal-breaker”.

robert-stuttaford14:07:57

i was talking more to the busy-work of having to recreate databases with new schema etc to test different setups

jellea15:07:49

Is the Datomic documentation available offline (as pdf, dash docset, repo)?

tcrayford16:07:23

@akiel: note: not all segments are cached, log segments aren't, neither are things from the gc

akiel17:07:30

@tcrayford: what do you mean with gc?

tcrayford17:07:21

the "list of segments to gc" is stored in storage somewhere. When you run d/gc-storage it has to query that stuff and it's not cached

akiel17:07:50

ah ok - so this is only a maintenance thing