ClickHouse SQL Formatter
Free online ClickHouse SQL formatter. Format ClickHouse queries with support for ARRAY JOIN, MergeTree ENGINE declarations, aggregate combinators, and ClickHouse-specific analytical syntax.
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
Does the ClickHouse formatter handle ARRAY JOIN?
Yes. ClickHouse's ARRAY JOIN clause (used to unnest arrays inline) is formatted on its own line in the query structure, alongside arrayMap(), arrayFilter(), and other array functions.
Will aggregate functions with combinators (-If, -Array, -State) be formatted?
Yes. ClickHouse aggregate function combinators (sumIf, avgArray, countState, etc.) are treated as function names and formatted with proper argument spacing and indentation.
Does it handle CREATE TABLE with MergeTree ENGINE?
Yes. ClickHouse's ENGINE = MergeTree() syntax, including ORDER BY, PARTITION BY, PRIMARY KEY, TTL, and SETTINGS clauses, are each formatted on their own line for maximum readability.
What about ClickHouse-specific syntax not in standard SQL?
ClickHouse closely follows standard SQL with extensions. The formatter handles the standard SQL core plus ClickHouse extensions using SQL-mode formatting. Operator syntax and function calls are preserved exactly as written.
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