Caching
Caching can reduce the overall number of queries that Lightdash executes against your data warehouse. Learn more about the types of caching and how to enable caching in this doc.
Lightdash supports two types of caching:
- Cached Filter values - enabled for every cloud user without requiring any configuration.
- Cached results for Charts and Dashboards - beta feature that must be enabled by the Lightdash team. This feature is only available for Pro, Enterprise, and self-hosted users since it requires a dedicated Lightdash instance.
Filter value caching
This type of caching works without any configuration for cloud users. You’ll see a message in your filter values that tells you when the cached filter values were loaded from (usually within the last day). If you want to refresh the filter values, you can click on that message and the values will be refreshed.
If you search filter values by starting to type, Lightdash will also cache those values so the next time you need the same search the values will be shown much faster.
Chart and dashboard results caching
Popular charts and dashboards will load faster when caching is enabled. The first user to visit a chart or dashboard each day will load fresh results from the warehouse, which get cached. After that, all following visits to the same chart or dashboard will load from the cached results.
Any changes to the chart query or dashboard queries (user attributes, filters, limit, date zoom) will trigger new queries to the warehouse and create a separate cached results entry.
Caching popular charts and dashboards will reduce warehouse costs to the organization by reducing the number of queries; it also improves server performance and makes the user experience much faster in Lightdash.
Scope of the cache
This is how various areas of Lightdash work (or don’t work) with cached results.
- Queries in the Query Builder, when creating or updating a saved chart, are NOT cached because they are typically one-off explorations that don’t benefit from caching.
- Saved Charts are cached based on the last refresh in any context (edit mode, view mode, dashboard refresh, etc.)
- Dashboard and Embedded dashboard tiles will use the cache from Saved Charts they reference. If Charts only exist on a single Dashboard, they will refresh whebnever you click the Refresh button on the Dashboard.
- Scheduled Deliveries generate and use cached results for the Saved Chart or Dashboard they belong to.
- Charts built in SQL runner or semantic layer integrations are NOT cached.
Cache Mechanism
The cache is stored in S3 and the cache identifier is based on the project ID and the generated SQL. This means that any change to the selected columns, filters, joins, user attributes, etc. will trigger a new query to the warehouse and add a new cache entry for that query.
Cache Expiry and Invalidation
Cached results automatically expire after 24 hours. The expiry time is configurable at the organization level, but you’ll need to reach out to the Lightdash team.
The dashboard header displays the date and time of the chart with the oldest cache. If no time is displayed, then no charts are cached. You can invalidate and refresh cached dashboard results by pressing the dashboard refresh button.
There is currently no way to invalidate cached results for individual Saved Charts.