Forum Discussion

MikeTamoush's avatar
MikeTamoush
Qrew Commander
3 years ago

Formula Query vs Summary Field

Does anyone know if a Summary field (say a total of numbers) or a formula query which gathers the same info, is more resource heavy?

I'm wondering if there is a rule of thumb, like - for a basic summary field on a parent, use summaries. If the summary field will be pulled to a grandparent or great grandparent, use a formula query.

------------------------------
Mike Tamoush
------------------------------

2 Replies

  • My own belief is that relationship summary fields are always more efficient even if they have to flow up a few levels.  But I don't have a way to prove that.  That would be a great question at an EMPOWER session or a formula queries training session. 


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • hhersch's avatar
      hhersch
      Qrew Captain
      Too many variables to make a blanket statement. When you define a relationship, we do some magic behind the scenes that allows us to anticipate some of your needs, like summary fields. So about the only scenario we can say for sure would be faster would be a single relationship with scalar data only with a summary field vs a query.

      Other than that, it is impossible to say for sure. We have many situations where the queries are faster depending on the levels of relationship, amount of derived fields, whether you are using things like now() or user() (which are amazing, they just reduce the amount of things we can cache).

      We have tons of internal test cases that run trying to compare them in different scenarios, and notably to make sure things are staying fast, or getting faster. What I suggest, if you are really interested, is using the performance analyzer. Remove all variables except your single field and make a form with only that field on it. Then run the analyzer. Then switch your fields on the form, and run the analyzer again. That will give you the answer for your specific build.

      Note that the complexity gets exponentially higher if these are used in permissions and a few other things. But the instructions above are a reasonable baseline.

      ------------------------------
      Harrison Hersch
      ------------------------------