persist_for (for Explores)

This page refers to thepersist_for parameter that is part of anExplore.

persist_for can also be used as part of a model, described on thepersist_for (for models) parameter documentation page.

persist_for can also be used as part of a derived table, described on thepersist_for (for derived tables) parameter documentation page.

Usage

explore: explore_name {  persist_for:"1 hour"}
Hierarchy
persist_for
Default Value
Thepersist_for setting of the model

Accepts
A string containing an integer followed by a timeframe (seconds, minutes, or hours)

Special Rules
Apersist_for setting at theexplore level will override thepersist_for setting at the model level

Definition

For more robust cache management, including synchronizing your Looker cache policy to your database's ETL (extract, transform, and load) process, consider using adatagroup andpersist_with, as described on theCaching queries documentation page.

persist_for lets you modify the amount of time that cached query results are used for a given Explore. The default cache length in Looker is 1 hour. Cache results are stored in an encrypted file on your Looker instance.

The caching mechanism in Looker works as follows: Once a user runs a specific query, the result of that query is cached. If precisely the same query (everything must be the same, including things such as the row limits, etc.) is run again, in less than the interval specified bypersist_for, the cached results are returned. Otherwise, a new query is run against your database.

When thepersist_for interval expires, data is deleted from the cache. See theCaching queries documentation page for information on how long data is stored in the cache.

Ifpersist_for is set for both an Explore andits model, the value set for the Explore will take priority for queries based on that Explore.

From an Explore, you cansee whether a query was returned from cache or you canforce new results to be generated from the database. See theCaching queries documentation page for more information.

Examples

Adjust the cache length to 2 hours:

explore: my_explore {  persist_for: "2 hours"}

Adjust the cache length to 30 minutes:

explore: my_explore {  persist_for: "30 minutes"}

Turn off caching so that users never get cached results for a query:

explore: my_explore {  persist_for: "0 seconds"}

Things to consider

Whenpersist_for is set to0 seconds, your users' queries will not retrieve data from the cache. However, Looker requires the disk cache for internal processes, so your encrypted data will always be written to the cache, even whenpersist_for is set to0 seconds. Once written to the cache, the data will be flagged for deletion but may live up to 10 minutes on disk. See theCaching queries documentation page for details.

persist_for does not necessarily align with your data import

Many companies have a daily data import to their analytics database. Sometimes, they reason that there is no purpose running fresh queries if the data isn't constantly updated anyway, so they set the cache length to 24 hours (likepersist_for: 24 hours). However, this will not prevent users from getting data that is older than the most recent refresh.

For example, a query is run at noon on January 1st, new data is imported the morning of January 2nd, and then the query is run again at noon on January 2nd. Since the query was run within the 24 hour window specified bypersist_for, the data from January 1st will be returned, even though new data was loaded on January 2nd.

If you want your caching to be aligned with data imports, use adatagroup andpersist_with, as described in the documentation oncaching queries.

Scheduled Looks will cache results

When a scheduled Look is run, it creates a cached result set in the same way that a user run query would. To precache a certain Look, consider saving andscheduling it.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.