Amazon Redshift SQL Formatter

Free online Amazon Redshift SQL formatter. Format Redshift queries with support for DISTKEY, SORTKEY, COPY/UNLOAD commands, materialized views, and Redshift-specific functions.

Redshift
Input
Output

What is Amazon Redshift?

Amazon Redshift is a fully managed, petabyte-scale cloud data warehouse from AWS. It uses columnar storage and massively parallel processing (MPP) to deliver fast query performance on large analytical workloads. Redshift is optimized for OLAP workloads — aggregations, joins, and scans across billions of rows.

Redshift extends PostgreSQL with distribution and sort key declarations (DISTKEY, SORTKEY, DISTSTYLE) that control how data is physically distributed across nodes. It also provides COPY and UNLOAD commands for high-throughput data movement between Redshift and Amazon S3.

The Redshift SQL formatter correctly handles Redshift-specific DDL clauses — DISTKEY, SORTKEY, ENCODE, and DISTSTYLE — as well as COPY/UNLOAD statements, producing structured, readable SQL for Redshift data engineering workflows.

Frequently asked questions

Does the Redshift formatter handle DISTKEY and SORTKEY clauses?

Yes. Amazon Redshift's DISTKEY, SORTKEY, COMPOUND SORTKEY, INTERLEAVED SORTKEY, and DISTSTYLE clauses in CREATE TABLE are formatted on separate lines for clarity.

Will COPY and UNLOAD commands be formatted?

Yes. Redshift's COPY (for loading data from S3) and UNLOAD (for exporting to S3) commands with their parameter lists are formatted with each option on its own line for readability.

Does it support Redshift window functions?

Yes. Redshift window functions with OVER(), PARTITION BY, ORDER BY, and ROWS/RANGE BETWEEN frame specifications are all formatted with clear structure.

Will CREATE MATERIALIZED VIEW syntax be formatted correctly?

Yes. CREATE MATERIALIZED VIEW, REFRESH MATERIALIZED VIEW, and AUTO REFRESH options are all formatted correctly as Redshift-standard DDL statements.

Try Sequel

Query your database in plain English.

Connect your database and get instant answers without writing SQL. Free for up to 3 seats — no credit card required.

Get started free