Skip to content

Distribution Options

Within a CREATE TABLE statement, you can define a single-column distribution key, or you can set the distribution to RANDOM or REPLICATE:

DISTRIBUTE ON (column)

Hash distribution across the worker nodes based on the values in the specified column. The ON keyword is required. This option is recommended for most tables. For example:

create table team
(teamid smallint, htid smallint, atid smallint, name varchar(30), nickname varchar(20), city varchar(20), stadium varchar(50), capacity int) 
distribute on (teamid);

Note: You cannot distribute a table on:

  • Floating-point columns (FLOAT, FLOAT4, FLOAT8)
  • RANDOMIZED encrypted columns
DISTRIBUTE [ ON ] REPLICATE

Replication of the entire table across all blades. The ON keyword is optional. This option is intended for smaller tables. For example:

create table season
(seasonid smallint, season_name character(9), numteams smallint, winners varchar(30)) 
distribute replicate;
DISTRIBUTE [ ON ] RANDOM

Random distribution of table rows. The ON keyword is optional.

If you do not specify the DISTRIBUTE clause, the table is hash-distributed on the first-named column in the table. If you do not specify the DISTRIBUTE clause and the first column in the table is a floating-point column, RANDOM distribution is used.