Fork me on GitHub

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


@dominicm if your query can be phrased in a form that makes use of the log: 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 ( ) when it makes sense to invoke the lower level API calls directly.


@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?


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: (last section)