distkey

LookML
Version

On this Page
Docs Menu

Go to View Parameter List

distkey should be avoided as of release 3.26

Use distribution instead

Usage

distkey is a child of
derived_table is a child of
view
view: my_view
derived_table:
...
1st
Tab
2nd
Tab
distkey: column_name
a column from the
derived table sql

Definition

distkey allows you to specify the column from a persistent derived table on which to apply a distribution key. Currently, distkey only works with Redshift databases. Traditional SQL dialects (such as MySQL and Postgres) should use indexes.

Generally speaking, a distribution key should be applied to the column that will be acting as a foreign key (i.e. the column you’ll use to join your derived table to others). More information can be found in the Amazon Redshift documentation.

Examples

Create a customer_order_facts derived table with a distribution key on customer_id:

- view: customer_order_facts derived_table: sql: | SELECT customer_id, COUNT(*) AS lifetime_orders FROM order persist_for: 24 hours distkey: customer_id

Common Challenges

distkey Only Works With Derived Tables That Are Persisted

Derived tables can be calculated at query time, or they can be made persistent using persist_for or sql_trigger_value. distkey only works with persistent derived tables.

Still have questions?
Go to Discourse - or - Email Support
Top