# suggest_persist_for

<br />

## Usage

```
view: view_name {
  dimension: field_name {
    suggest_persist_for: "5 hours"
  }
}
```

|---|---|
| Hierarchy [View File](https://docs.cloud.google.com/looker/docs/reference/param-view) [`view`](https://docs.cloud.google.com/looker/docs/reference/param-view-view) [Field Type](https://docs.cloud.google.com/looker/docs/reference/param-field) `suggest_persist_for` | Possible Field Types Dimension, Filter, Parameter <br /> Accepts A string specifying the length of time in seconds, minutes, or hours as follows: "N (seconds \| minutes \| hours)" <br /> |

## Definition

When Looker determines the values that it will suggest to users when they filter on a [`dimension`](https://docs.cloud.google.com/looker/docs/reference/param-field-dimension) or [`filter`](https://docs.cloud.google.com/looker/docs/reference/param-field-filter) field, it runs a query to find the unique values of that field. By default this list of suggestions is cached for 6 hours. However, you can change the amount of time that suggestions are cached using `suggest_persist_for`.

Looker typically generates suggestions for a dimension by executing a `SELECT DISTINCT` query on that dimension. For some large tables this query can be too slow, or create too large of a database load. Caching suggestion values for a longer period reduces the number of `SELECT DISTINCT` queries. Alternatively, if your database is updated frequently, a shorter cache time results in fresher suggestion lists.

## Examples

Set the suggestion cache for the `name` dimension to 30 minutes:

    dimension: name {
      sql: ${TABLE}.name ;;
      suggest_persist_for: "30 minutes"
    }