Fork me on GitHub
#datomic
<
2016-10-22
>
dominicm22:10:23

With datomic, is there any optimization for "the most recent" or "the lowest"? To avoid doing a sort over a large dataset

Ben Kamphaus22:10:08

@dominicm if your query can be phrased in a form that makes use of the log: http://docs.datomic.com/best-practices.html#use-log-api that would work to the most recent case. For your own indexed attr/values of interest, there are many cases with comparison clauses where the :avet index is leverages, and you can also manually make use of index-range ( http://docs.datomic.com/clojure/#datomic.api/index-range ) when it makes sense to invoke the lower level API calls directly.

dominicm22:10:11

@bkamphaus I'll have to dig into those apis. I was a bit scared of touching the log. Are there any good links on making sure I don't abuse them? Or is it covered in the best practices doc?

Ben Kamphaus22:10:15

I’d say it’s mostly covered in that doc. I would always start with query and only change if you need to optimize (and have measured differences, etc. of course). For Log API, the starting point would to be to make use of log in query: http://docs.datomic.com/log.html (last section)