distribution_style

LookML
Version

On this Page
Docs Menu

Go to View Parameter List

Usage

distribution_style is a child of
derived_table is a child of
view
view: my_view
derived_table:
...
1st
Tab
2nd
Tab
distribution_style: ALL
a distribution style:
ALL
EVEN

Definition

distribution_style allows you to specify how the query for a persistent derived table is distributed across the nodes in a Redshift database. distribution_style will not currently work with other SQL dialects. Redshift offers 3 distribution styles, which is described in their documentation:

  • All Distribution: All rows are fully copied to each node. You can accomplish this type of distibution in Looker by using distribution_style: ALL.
  • Even Distribution: Rows are distributed to different nodes in a round-robin fashion. You can accomplish this type of distibution in Looker by using distribution_style: EVEN.
  • Key Distribution: Rows are distributed to different nodes based on unique values within a particular column. You can accomplish this type of distibution in Looker by using the distribution parameter.

See the Amazon Redshift documentation for choosing the appropriate distribution strategy. If you do not specify a distribution_style, and do not use the distribution parameter instead, Looker will default to ALL.

Examples

Create a customer_order_facts derived table with a distribution style of ALL:

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

Common Challenges

distribution_style 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. distribution_style only works with persistent derived tables.

distribution_style And distribution Are Mutually Exclusive

distribution_style and distribution should not be used at the same time. If you want to distribute the rows of a table to different Redshift nodes based on a column value, use distribution. Otherwise, use distribution_style to choose a different distribution strategy.

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