ClickHouse SQL Minifier

Free online ClickHouse SQL minifier. Compress ClickHouse queries to a single line while preserving ARRAY JOIN, aggregate combinators, MergeTree syntax, and ClickHouse-specific constructs.

⌘↵ to minify
Input SQL
Minified SQL

What is ClickHouse?

ClickHouse is an open-source column-oriented database management system designed for real-time analytical queries (OLAP). Developed at Yandex and now maintained by ClickHouse Inc., it can process billions of rows and hundreds of gigabytes per second on a single server, making it one of the fastest analytical databases available.

ClickHouse uses a family of MergeTree storage engines with support for data replication, partitioning, TTL-based data expiry, and materialized views. It extends standard SQL with ARRAY JOIN for unnesting arrays inline, aggregate function combinators (-If, -Array, -State, -Merge), and a rich set of built-in analytical functions.

The ClickHouse SQL formatter handles ClickHouse-specific syntax — ARRAY JOIN, MergeTree ENGINE declarations with ORDER BY, PARTITION BY, TTL, and SETTINGS clauses — keeping your ClickHouse DDL and analytical queries clean and readable.

Frequently asked questions

Will ARRAY JOIN syntax be preserved when minifying ClickHouse SQL?

Yes. ClickHouse's ARRAY JOIN clause is collapsed inline correctly. All array function calls (arrayMap, arrayFilter, etc.) are preserved with their arguments.

Are ClickHouse aggregate combinators preserved?

Yes. Aggregate combinators like sumIf, avgArray, and countState are treated as function names and preserved exactly — only whitespace around them is removed.

Will ENGINE clauses in CREATE TABLE be minified correctly?

Yes. ClickHouse's ENGINE = MergeTree() declarations with ORDER BY, PARTITION BY, TTL, and SETTINGS clauses are all collapsed inline without altering the table definition.

Why minify ClickHouse SQL?

Minified ClickHouse SQL is useful when embedding queries in HTTP API calls, Grafana data source configurations, Kafka connector SQL transforms, or any system where compact single-line SQL is preferred.

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