Skip to content

Commit

Permalink
add dashboard filters hit cache callout (#5710)
Browse files Browse the repository at this point in the history
this pr adds a callout the users can dynamically filter dashboards and
hit the cache as long as the the dimension is in the saved query config
  • Loading branch information
mirnawong1 authored Jul 1, 2024
1 parent d69ea9e commit 552c5ac
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions website/docs/docs/use-dbt-semantic-layer/sl-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ The dbt Semantic Layer allows you to cache common queries in order to speed up p
There are two different types of caching:

- [Result caching](#result-caching) leverages your data platform's built-in caching layer.
- [Declarative caching](#declarative-caching) allows you to pre-warm the cache using saved queries.
- [Declarative caching](#declarative-caching) allows you to pre-warm the cache using saved queries configuration.

While you can use caching to speed up your queries and reduce compute time, knowing the difference between the two depends on your use case: result caching happens automatically by leveraging your data platform's cache, while declarative caching allows you to 'declare' the queries you specifically want to cache. With declarative caching, you need to anticipate which queries you want to cache.
While you can use caching to speed up your queries and reduce compute time, knowing the difference between the two depends on your use case:

- Result caching happens automatically by leveraging your data platform's cache.
- Declarative caching allows you to 'declare' the queries you specifically want to cache. With declarative caching, you need to anticipate which queries you want to cache.
- Declarative caching also allows you to dynamically filter your dashboards without losing the performance benefits of caching. This works because filters on dimensions (that are already in a saved query config) will use the cache.

## Prerequisites
- dbt Cloud [Team or Enterprise](https://www.getdbt.com/) plan.
Expand Down Expand Up @@ -42,17 +46,15 @@ Different data platforms might have different caching layers and cache invalidat

## Declarative caching

Declarative caching enables you to pre-warm the cache using [saved queries](/docs/build/saved-queries) by setting the cache config to `true` in your `saved_queries` settings. This is useful for optimizing performance for key dashboards or common ad-hoc query requests. For configuration details, refer to [Declarative caching setup](#declarative-caching-setup).
Declarative caching enables you to pre-warm the cache using [saved queries](/docs/build/saved-queries) by setting the cache config to `true` in your `saved_queries` settings. This is useful for optimizing performance for key dashboards or common ad-hoc query requests.

<details>
:::tip
Declarative caching also allows you to dynamically filter your dashboards without losing the performance benefits of caching. This works because filters on dimensions (that are already in a saved query config) will use the cache.

<summary> 📹 Check out this video demo to see how declarative caching works!</summary>
For example, if you filter a metric by geographical region on a dashboard, the query will hit the cache, ensuring faster results. This also removes the need to create separate saved queries with static filters.
:::

This video demonstrates the concept of declarative caching, how to run it using the dbt Cloud scheduler, and how fast your dashboards load as a result.

<LoomVideo id='aea82a4dee364dfdb536e7b8068684e7' />

</details>
For configuration details, refer to [Declarative caching setup](#declarative-caching-setup).

How declarative caching works:
- Make sure your saved queries YAML configuration file has [exports](/docs/use-dbt-semantic-layer/exports) defined.
Expand All @@ -61,6 +63,16 @@ How declarative caching works:
- Make sure any query requests that match the saved query's inputs use the cache, returning data more quickly.
- Automatically invalidates the cache when it detects new and fresh data in any upstream models related to the metrics in your cached table.
- Refreshes (or rebuilds) the cache the next time you run the saved query.

<details>

<summary> 📹 Check out this video demo to see how declarative caching works!</summary>

This video demonstrates the concept of declarative caching, how to run it using the dbt Cloud scheduler, and how fast your dashboards load as a result.

<LoomVideo id='aea82a4dee364dfdb536e7b8068684e7' />

</details>

Refer to the following diagram, which illustrates what happens when the dbt Semantic Layer receives a query request:

Expand Down

0 comments on commit 552c5ac

Please sign in to comment.