Amazon Redshift SQL Minifier

Free online Amazon Redshift SQL minifier. Compress Redshift queries to a single line while preserving DISTKEY, SORTKEY, COPY/UNLOAD syntax, and all Redshift-specific constructs.

⌘↵ to minify
Input SQL
Minified SQL

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

Will DISTKEY and SORTKEY clauses be preserved after minification?

Yes. All Redshift DDL clauses — DISTKEY, SORTKEY, DISTSTYLE, ENCODE — are collapsed inline without altering the clause structure. Only whitespace is removed.

Why would I minify Redshift SQL?

Redshift SQL is commonly minified when embedding queries in AWS Lambda functions, Step Functions definitions, or Terraform aws_redshift_parameter_group resources where whitespace adds no value.

Are COPY and UNLOAD commands safely minified?

Yes. COPY and UNLOAD commands with their parameters are minified correctly. Each parameter is placed inline without altering the semantics of the command.

Does minification affect Redshift query performance?

No. Redshift's query planner generates identical execution plans for minified and formatted queries. Whitespace has no effect on query compilation or performance.

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