diff --git a/website/docs/docs/use-dbt-semantic-layer/sl-cache.md b/website/docs/docs/use-dbt-semantic-layer/sl-cache.md index 4faa297f4ee..12f5c176e9e 100644 --- a/website/docs/docs/use-dbt-semantic-layer/sl-cache.md +++ b/website/docs/docs/use-dbt-semantic-layer/sl-cache.md @@ -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. @@ -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. -
+:::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. - 📹 Check out this video demo to see how declarative caching works! +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. - - - -
+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. @@ -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. + +
+ + 📹 Check out this video demo to see how declarative caching works! + +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. + + + +
Refer to the following diagram, which illustrates what happens when the dbt Semantic Layer receives a query request: