How to change the distribution style of a table in Redshift database

You can modify the distribution style of a table using below sql command:

alter table tablename alter diststyle AUTO|ALL|EVEN|KEY DISTKEY columnname;

Modify table to use AUTO distribution style:

alter table tablename alter diststyle AUTO;

Modify table to use ALL dist style:

alter table tablename alter diststyle ALL;

Modify table to use EVEN dist style:

alter table tablename alter diststyle EVEN;

Modify table to use KEY dist style:

alter table tablename alter diststyle KEY DISTKEY columnname;

See also  How to list Materialized views, enable auto refresh, check if stale in Redshift database