home User Guide Getting Started Help Center Documentation Community Training Certification
menu
close
settings
Looker keyboard_arrow_down
language keyboard_arrow_down
English
Français
Deutsch
日本語
search
print
distribution_style

Usage

view: my_view {
  derived_table: {
    distribution_style: all
    …
  }
}

Hierarchy

distribution_style

- or -

distribution_style

Default Value

None

Accepts

A distribution style (all or even)

Special Rules

distribution_style is supported only on specific dialects

Definition

distribution_style allows you to specify how the query for a persistent derived table (PDT) or an aggregate table is distributed across the nodes in a database.

See the Dialect support for distribution_style section below for the list of dialects that support distribution_style.

The distribution_style parameter works only with tables that are persistent, such as PDTs and aggregate tables. distribution_style is not supported for derived tables without a persistence strategy.

In addition, the distribution_style parameter is not supported for derived tables that are defined using create_process or sql_create.

Lastly, 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.

Redshift offers three distribution styles, which are described in their documentation:

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 GROUP BY 1 ;; persist_for: "24 hours" distribution_style: all } }

Dialect support for distribution_style

The ability to use distribution_style depends on the database dialect your Looker connection is using. In Looker 21.16, the following dialects support distribution_style:

Top