ClickHouse Fiddle — A SQL Playground for ClickHouse

Igor Baliuk
6 min readintermediate
--
View Original

Overview

ClickHouse Fiddle is an open-source SQL playground designed for executing SQL queries directly from a browser without the need for a local database instance. This article discusses its motivation, design, and the unique features that differentiate it from existing SQL playgrounds.

What You'll Learn

1

How to run SQL queries in various versions of ClickHouse without local installation

2

Why using an online SQL playground can simplify testing and sharing SQL queries

3

When to use ClickHouse Fiddle for quick SQL experimentation

Key Questions Answered

What are the unique features of ClickHouse Fiddle compared to other SQL playgrounds?
ClickHouse Fiddle allows users to run both DDL and SQL queries in isolated Docker containers for various ClickHouse versions, unlike other platforms that may restrict to read-only queries or require always-on instances. This flexibility enhances experimentation and sharing of SQL code.
How does ClickHouse Fiddle ensure isolation between query executions?
ClickHouse Fiddle uses ephemeral Docker containers to isolate each query execution. This means that data from one execution is not accessible in another, ensuring a clean environment for each user interaction.
What is the typical execution time for queries in ClickHouse Fiddle?
Execution of a simple query on a hot database version typically takes several seconds, with the 90th percentile run duration being approximately 2 seconds. This indicates efficient performance for users running queries in the playground.

Key Statistics & Figures

90th percentile query execution time
approximately 2 seconds
This performance metric applies to queries executed on a hot database version in ClickHouse Fiddle.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Utilize ClickHouse Fiddle for rapid SQL testing and sharing without the overhead of local installations.
This is particularly useful for developers who need to validate SQL queries quickly or share results with colleagues without setting up a full database environment.
2
Leverage the ability to execute DDL queries in ClickHouse Fiddle to experiment with database schema changes.
This feature allows engineers to prototype database structures and test SQL logic in a safe, isolated environment before applying changes to production.
3
Consider using ClickHouse Fiddle to explore new SQL constructs and their compatibility with different ClickHouse versions.
This can help engineers stay updated with the latest SQL features and ensure that their applications are using supported constructs.

Common Pitfalls

1
Assuming that ClickHouse Fiddle can be used for performance benchmarking.
ClickHouse Fiddle is designed for quick testing and experimentation, not for measuring database performance, which should be done in a production-ready environment.