+1 (726) 227-2971

Better Filter Suggestions in Looker: suggest_dimension, suggest_explore, and suggest_persist_for

Every Looker user meets filter suggestions: you start typing into a filter box and a list of values appears. By default Looker builds that list by running a SELECT DISTINCT against the dimension's column. That is fine on a small table and painful on a large one. This tutorial shows how to take control of suggestions in LookML.

Why suggestions deserve attention

  • Performance: a distinct query on a billion-row fact table can be slow and costly on a warehouse billed by bytes scanned.
  • Quality: raw values such as NULL, test accounts, or retired product codes clutter the list.
  • Consistency: a filter on a field from a big fact table should often draw its options from a small dimension table.

1. Turn suggestions off or supply a static list

Use suggestions: no to disable the dropdown, or provide a fixed list with suggestions:

dimension: order_status {
  type: string
  sql: ${TABLE}.status ;;
  suggestions: ["pending", "shipped", "delivered", "returned"]
}

Static lists are ideal for small, stable domains. Remember they will not update when the data does, so review them when the underlying values change.

2. Borrow values from another dimension with suggest_dimension

suggest_dimension points a field at a different dimension in the same view, often a cheaper one:

dimension: country_code {
  type: string
  sql: ${TABLE}.country_code ;;
  suggest_dimension: country_name
}

The values come from the named dimension, so make sure it produces values that are valid filter input for the original field.

3. Use a small table through suggest_explore

When the best source of values lives in another explore, combine suggest_explore with suggest_dimension:

explore: product_lookup {
  hidden: yes
}

view: order_items {
  dimension: product_category {
    type: string
    sql: ${TABLE}.category ;;
    suggest_explore: product_lookup
    suggest_dimension: product_lookup.category
  }
}

The suggestion query now runs against a small lookup explore rather than the fact table. Because the explore is a normal LookML object, you can also apply sql_always_where there to exclude test or inactive values from the list. Check that the people filtering can access the explore you point to, and that access filters on it do not hide values they should see.

4. Control freshness with suggest_persist_for

Looker caches suggestion results. Use suggest_persist_for to set how long:

dimension: customer_segment {
  type: string
  sql: ${TABLE}.segment ;;
  suggest_persist_for: "24 hours"
}

Pick a duration that matches how often the values really change. Daily is common for slowly changing categories. Looker's datagroup-based caching governs query results; check the documentation for how your Looker version applies it to suggestions.

5. A practical pattern

  1. Find the filters used most in dashboards, via System Activity.
  2. For each high-cardinality or slow filter, identify a small table that holds the valid values.
  3. Expose it as a hidden explore and wire up suggest_explore and suggest_dimension.
  4. Add suggest_persist_for to match the refresh cadence.
  5. Test in the Explore UI: check that values are correct, fast, and permission-safe.

Common pitfalls

  • Suggesting from a dimension whose values differ in format from the filtered column, so selecting a suggestion returns no rows.
  • Forgetting that a static list silently goes stale.
  • Pointing suggestions at an explore with row-level access filters that differ from the main explore.
  • Using suggestions: no everywhere, which makes dashboards harder to use.

Wrapping up

Suggestion tuning is a small LookML change that makes dashboards faster and friendlier. If your Looker instance has sluggish filters or you want a review of your model's user experience, the senior Looker developers at Vistelio can help with a model audit or hands-on development.