Documentation Index

Fetch the complete documentation index at: https://kb.pigment.com/llms.txt

Use this file to discover all available pages before exploring further.

Manage Model Performance

Prev Next

This section of the Knowledge Base brings together the tools and best practice you need to analyze and optimize the performance of your Pigment Applications.

It explains how to use performance insights to identify bottlenecks, apply scoped calculations to reduce unnecessary recomputation, and profile calculation paths to understand how changes propagate through your model. Together, these features help you pinpoint inefficiencies, optimize formulas, and keep your Applications fast, scalable, and easier to maintain.

The following sections provide general guidance on improving model performance.

Align the structure of your Blocks with formulas

Your formula’s output should contain the same Dimensions as your Metric’s structure. Misaligned formulas can result in unexpected results and aren’t performant. Review any hints appearing in formulas that are misaligned with the structure of the Block. Optimize your formulas by explicitly adding or removing those Dimensions in the formula itself. For more information, see Modeling Hints.

Keep your model clean by removing unused Blocks

Unused Blocks can result in inefficient models, especially if they are dense. You can check the detail of where the Block is being used in Block settings, under Block Usage. For more information, see Block settings for Metrics.

Review Blocks with a high number of usages in your model

Also in Block Usage is the number of usages of your Block. The higher the number, the more central this Block is for your model.

ℹ️ Note

Any modifications or improvements on these central Blocks have a lot of downstream impact. Focus your review on these Blocks.

Quick tips on formula optimizations on these central Blocks:

  • Reduce the length of formulas where possible.

  • Avoid nested IF statements that are hard to read or maintain and are not performant.

  • If you can, perform the calculation on multiple intermediary Blocks rather than a single Block. It’s more performant to split this up.

Best practice for improved formula executions

Some recommendations for making Metric formula executions faster:

  • If the Metric contains a long formula with nested functions, consider breaking up the formula into Metrics and then referencing those Metrics in the formula. This results in a shorter formula per Metric, which may reduce execution time.

  • When you break up your formulas into multiple Metrics, ensure that you use formula calculations in a Metric once. You can then re-use that Metric by referencing it multiple times if needed. This reduces the number of formula executions and optimizes performance. It also reduces the number of Metrics needed and reduces maintenance.

  • Ensure that your formula is performing calculations on a smaller scope of your data. Narrowing this scope as early as possible prevents you from performing unnecessary calculations on data that will be discarded later.

    • For example, use the FILTER function on specific Items of the Dimension to improve performance. Try to build your formulas to calculate on the smallest possible scope of data for that calculation.

    • See Optimize formulas with scoped calculations for more information.

  • The order in which you list functions in a formula can greatly improve performance.  

    • For example, reduce the data size as soon as possible within your formula using IF() or [FILTER:] or [SELECT:] before doing additional aggregations using functions or [REMOVE:] or [BY:].

    • Next, allocate by adding new Dimensions using IF(), IFDEFINED() or [BY:].