Aller au contenu

Leçon 22 · Sharing, Governance and Performance

Performance, Caching and Materialization

Make Sigma workbooks faster and cheaper: find the slow part, reuse parent elements, understand cache layers and refreshes, and use materialization well.

A slow dashboard loses readers, and a wasteful one costs money. Because Sigma runs queries on your data platform, performance depends on both your workbook design and the platform. This lesson gives you a method.

Find the problem first

Sigma's performance guidance starts by identifying the pattern. The table adds likely places to look:

Symptom Likely area to look at
One element is slow Its source, joins, formulas
Many elements are slow Shared source or filters, warehouse load
Slow only sometimes Busy compute, expired caches
Slow when changing a control Which elements the control targets

Change one thing at a time and measure again. Guessing wastes time.

Design improvements

The documented advice includes:

  • Use one parent element per data source and build others as its children.
  • If several elements need the same data from custom SQL, use one SQL element as the shared parent.
  • Denormalize tables in the warehouse or data model, and add calculated columns in the model.
  • Use relationships instead of joins when only some analyses need the related columns.
  • Do lookups and heavy transformations, such as parsing JSON, in a data model or grandparent element.
  • Apply shared filters to the parent and target controls at the parent.
  • Remove unneeded columns, put elements only on the pages that need them, collapse groups and hide summary bars.
  • Use custom SQL sparingly, because it adds an extra schema query, and control references can force reruns.

The same guidance also suggests joining in Sigma rather than in the warehouse in some cases. The right choice depends on your data, so measure.

Cache layers

Sigma's documentation says it checks these layers before querying the warehouse again:

  1. Browser cache: reuses data already in the browser for changes that need no new data.
  2. Alpha Query: recalculates from data cached in the browser, for example when you add some aggregates or filters.
  3. Query ID cache: on some platforms, such as Snowflake and BigQuery.
  4. Universal result cache (beta): reuses earlier results and needs extra setup.
  5. Warehouse query: if nothing can be reused.

With OAuth connections, the third and fourth layers apply only when service account credentials are used. Manual and scheduled refreshes bypass the caches, and frequent auto-refresh can raise warehouse costs. The documentation describes a default query ID cache duration of 10 minutes, which can be changed. Check current settings before relying on them.

Python Stand-in: a cache with a time limit

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A real cache has more rules. The point is that repeated requests can be served cheaply, and that freshness is the price.

Materialization

Materialization precomputes a result and stores it in the data platform, so Sigma can read an optimized table instead of recalculating from raw data. Sigma documents it for data elements in data models and workbooks (scheduling was labeled beta when checked). It needs the right permissions, a scheduled run uses the latest published version, and by default it runs as the user who scheduled it. By default, Sigma pauses a scheduled materialization that has not been used for 60 days, and also one that fails five runs in a row. Admins can change the unused-period setting. If a materialization of a data element fails, the documentation says the element uses live data.

Use it when data changes rarely and is queried often. Schedule it after upstream loads finish, ideally when few users are active.

Be cautious when:

  • the result depends on dynamic values such as controls or the current user (Sigma advises against materializing these);
  • you would need to refresh as often as the data changes, and that costs more than it saves.

Do not point controls or filters at a materialized element. Materialize a parent and filter a child.

SQL Stand-in: precompute a summary table

Press Run (or Ctrl + Enter) to see the result here.

The summary has fewer rows, but its total differs after a late row arrives. That is the trade-off between speed and freshness.

A note about identity

A materialized or cached result was computed under some identity. Per-user security rules and shared precomputed data do not always mix. Test security again after you enable caching or materialization.

A tuning routine

  1. Write down what is slow and how long it takes.
  2. Check the query information available to you and to your platform admin.
  3. Reduce rows and columns first.
  4. Remove repeated work by sharing parents.
  5. Consider cache settings, then materialization.
  6. Measure again and check that the numbers did not change.

Common mistake: setting a very short auto-refresh "to be safe". It can create constant warehouse queries for a dashboard that nobody is watching.

Record your results

Keep a small log with the date, the change, the load time before and after, and the key total before and after. Without it, you cannot tell which change helped, or whether one of them quietly changed a number. Test at a similar time of day, and remember that a second load may be faster only because of a cache.

Also tell readers how fresh the page is. A fast page that silently shows old numbers can mislead more than a slow one, so state the expected update time near the title.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is a good first step with a slow workbook?

    The pattern points to the cause and the right fix.
  2. 2. What do manual and scheduled refreshes do with caches?

    The documentation says refreshes bypass the caching options.
  3. 3. Which situation fits materialization well?

    Precomputing pays off when reads are frequent and updates are rare.
  4. 4. How should you use controls with a materialized element?

    This keeps the precomputed result usable while still allowing filtering.

Summary

  • Diagnose before you optimize.
  • Share parents, filter early and remove unneeded work.
  • Several cache layers can avoid warehouse queries; refreshes bypass them.
  • Materialization trades freshness for speed.
  • Re-test results and security after changes.

Next: Custom SQL, Python, AI and Embedding

Votre progression est enregistrée dans ce navigateur. Aucun compte nécessaire.