indexes is a child of
derived_table is a child of
one or more columns from
the derived table sql
indexes allows you to specify one or more columns of a persistent derived table on which to apply an index. When you add more than one column, Looker will create one index for each individual column that you specify; it does not create a single, multi-column index.
If you use
indexes with Redshift, you will create an interleaved sort key, which is overviewed in this blog post. You can also create regular sort keys using
sortkeys, but you cannot use both at the same time. Distribution keys can be created with
Generally speaking, indexes should be applied to primary keys and date or time columns.
Create a customer_order_facts persistent derived table with an index on customer_id, assuming you’re using a traditional database (MySQL, Postgres, etc):
Create a customer_day_facts derived table with indexes on both customer_id and date, assuming you’re using a traditional database (MySQL, Postgres, etc):
Create a customer_day_facts derived table with an interleaved sort key built from customer_id and date, assuming you’re using Redshift: