Datagroup parameter in looker used to define different caching policies for different Explores. Datagroups in Looker is very useful when we want to defind different cache time for different explores.

Details of the caching policy can be defined using one or both of these datagroup parameters:
sql_trigger: Need to give sql query which returns one row with one column. If the value returned by the query is different datagroup will goes into triggered state. Basically datagroup will come to one conclusion whether new rows are added into database or not.
Ex: SELECT max(order_id) FROM orders
max_cache_age : max_cache_age parameter defines a time period. The time period is the maximum time period which looker uses cached results. This contains string with an integer followed by “seconds”, “minutes”, or “hours”
Ex: max_cache_age: “5 hours”
Example of Datagroup:
datagroup: orders_dg {
label: “Order Item datagroup”
description: “Trigger when new Order ID added into system”
max_cache_age: “24 hours”
sql_trigger: SELECT max(id) FROM orders ;;
}
To use the orders_dg caching policy as the default for Explores in a model, we should use with persist_with parameter at the model level.
Datagroups in looker:
persist_with: orders_datagroup
explore: order_items {
persist_with: orders_dg
join: orders {
sql_on: ${orders.id} = ${order_items.order_id} ;;
type: left_outer
relationship: many_to_one
}
}
For Details about looker training click here