Optimizing slow formulas in your doc

Find formulas slowing down your doc and increase their performance with a few modifications

Updated over a week ago

# Getting started

Before trying any of these steps, we recommend reviewing this article on troubleshooting calculation to help identify any formulas slowing down your doc.

When your doc is done calculating, the performance tool will give you a sorted list of which tables took the longest to calculate.

1. Expand the name of the table to see which specific columns contain a slower formula.

2. Click the name of the table to navigate to it, then open the formula that is slow.

3. If you no longer need it, delete the column or formula.

4. If you do need it, look through the list of Top Tips below. If your formula is listed, follow the instructions to adjust it before looking at the General Guidelines.

5. If you don't see your formula on the list, read the list of General Guidelines at the bottom of this page for more ideas of how to optimize your doc.

6. If nothing else works, please contact our support team with a screenshot of the formula and we can look at it for you. We're happy to help!

# Best practices with Filter() formulas

The example below refers to the Filter() formula, but the same tips apply for similar formulas that process values from each row in a table, such as Lookup(), CountIf(), and AverageIf().

For doc design examples, explore Ben Lee’s doc on good doc building habits, which covers Filter() formula best practices in detail.

## Make valid comparisons

If you are comparing 2 values, like inside a Filter() formula, make sure that they are of the same type. For example if you are comparing an entire column of values to a single value as follows:

In the part inside Filter() in the Formula above, the icons indicate that the left hand side returns a list of values while the right hand side is a single value. Instead the correct formula would be as follow, where the types on both sides are the same:

# General guidelines

1. Be mindful of the Now() formula: If you are using the Now() formula, consider which precision parameter you're using. For example Now("hour") will recalculate once an hour, whereas Now("second") will recalculate 3600 times an hour. Using the Now() that matches your need is one way to optimize your doc's performance.

1. For a simple optimization, consider switching to the Today() formula instead if that can serve your need.

2. Write more atomic formulas: If your formula is performing some complex set of calculations, you can split it up into several different columns or formulas with each one being more atomic. This allows Coda to optimize as many of those calculations as possible. This is also helpful in case some of those calculations are repeated across different columns, and you can just reuse the results rather than forcing Coda to recalculate them each time.

3. Fix any errors: Coda is much better at understanding & optimizing formulas when they are error free.

4. Choose the right column formats to match the type of data: Coda allows you to put data in a column even if it doesn't match the column format. However, if you do not choose the correct column format Coda has to be more cautious in calculating them rather than making assumptions and optimizing them. Choosing the right column format can also improve calculation performance.

5. Reduce number of views: In some docs, the number of views is so large that the filters and conditional formats on all those views take too long to calculate even if no individual column in the table is slow. This is not usually an issue for docs with several dozen views but we've sometimes seen docs with a significant number of views, where the views themselves took 10-20 seconds to recalculate each time the data in the doc changed. If this is the case for your doc, you might want to consider using an interactive control to filter a single view rather than creating lots of views for each value.

6. Reduce the pack refresh rate: In docs that have Packs, loading the most up to date data from some packs can prevent other calculations from completing. You might want to consider reducing the frequency of these refreshes or setting them to be manual rather than scheduled to be every hour or day.