cluster_keys: ["customer_city", "customer_state"]
- or -
AcceptsOne or more clustered column names
Clustering a partitioned table sorts the data in a partition based on the values in the clustered columns and organizes the clustered columns in optimally sized storage blocks. Clustering can improve the performance and reduce the cost of queries that filter on or aggregate by the clustered columns.
See the Dialect support for
cluster_keyssection below for the list of dialects that support
cluster_keysparameter works only with tables that are persistent, such as PDTs and aggregate tables.
cluster_keysis not supported for derived tables without a persistence strategy.
In addition, the
cluster_keysparameter is not supported for derived tables that are defined using
Lastly, Google BigQuery supports clustering on partitioned tables only. The
cluster_keysparameter works only with PDTs or aggregate tables that are also partitioned using the
To add a clustered column to a persistent derived table (PDT) or an aggregate table, use the
cluster_keys parameter and supply the names of the columns you want clustered in the database table.
customer_order_facts native derived table on a Google BigQuery database, partitioned on the
date column and clustered on the
gender columns to optimize queries that are filtered or aggregated on those columns:
Things to consider
Google BigQuery tables can partition only on date fields
Google BigQuery tables can be partitioned only on a date or timestamp column. If you want to add clustered columns to a PDT or aggregate table that does not include date or time-based data, one way to do that is to add a date column using a SQL statement such as
SELECT CURRENT_DATETIME() as now, and then use
partition_keys to partition on the new column. You can then use clustering on other columns in your PDT or aggregate table.
Dialect support for
The ability to use
cluster_keys depends on the database dialect your Looker connection is using. In Looker 21.16, the following dialects support