Ask questions on the official Q&A site at https://ask.datomic.com!
tatut 2021-04-15T05:00:02.299Z

yes, I’ve upvoted that but it doesn’t seem to have more info


At work we tried both suggestions, and switched from the postwalk approach to the xforms. Mostly because of performance. We tend to def our pull expressions for re-use, so the xforms are in 1 place. Needing to remember it's a db/ident isn't much of a problem for us, it's required to pull db/ident anyway. But one could always write a linter make sure that xforms is used for idents.

tatut 2021-04-15T08:18:18.304100Z

is walk so slow? I’ve used it heavily and never had it be a problem in my work loads


We had a specific usecase where we had very big resultsets (~150,000 entities + nesting). That's when we replaced the postwalk. Generally it's fine for sure.

tatut 2021-04-15T12:36:13.304700Z

that is a big result, out of curiosity, how much was the difference between walk and xform with that result?


Great thanks, that makes a lot of sense


Unfortuinely I don't have exact numbers. We also optimised the query at that time.


I was going to post this question here, and then I thought the forum might be a better place. Happy to have any input! https://forum.datomic.com/t/query-populous-business-entity-where-there-are-changes-at-any-level/1830

tatut 2021-04-19T05:02:56.324700Z

that looks quite tricky, can’t really say how make the query faster, but if you could update some attr on the root every time you update some descendant (like :root/recursive-modification-time timestamp), you could simply query all roots based on that

tatut 2021-04-19T05:04:19.324900Z

in effect moving the “has some descendant changed” determination from query time to tx time


Hey, I never thanked you for this response, so thank you! When we discussed it on the team that was definitely a solution that came up when we asked "how would we have done this in SQL-land". I personally suspect that something may be wrong with my recursive rules, but I'm still working through some of the details. Jaret posted a great set of questions for us, which I'm working on answering

kenny 2021-04-15T16:40:11.308Z

We also have very big query results.


To give a very rough idea about our postwalk approach vs a direct update fn;

  (do (map (fn [x] (update x :field :db/ident))
"Elapsed time: 0.093924 msecs"
=> nil
  (do (walk/postwalk (fn [x]
                       (if (and (map? x)
                             (:db/ident x))
                         (:db/ident x)
"Elapsed time: 552.667018 msecs"
=> nil
(corpus is a list of 150,000 maps btw)