Setup & Prerequisites

TL;DR

Choose your setup: ClickHouse Local (simplest), Docker (development), or Tinybird Local (production-like).

Option 1: ClickHouse Local

Quick start for learning and testing examples.

# Download and install curl https://clickhouse.com/ | sh # Verify clickhouse local --query "SELECT version()" # Interactive mode clickhouse local

Zero setup, instant start. No persistence by default, single-node only.


Option 2: Docker

For development, testing, and reproducible environments.

Create docker-compose.yml:

services: clickhouse: image: clickhouse/clickhouse-server:latest ports: - "8123:8123" - "9000:9000" volumes: - clickhouse_data:/var/lib/clickhouse volumes: clickhouse_data:
docker-compose up -d docker-compose exec clickhouse clickhouse-client

Full server features with persistence. Single node. Requires Docker.


Option 3: Tinybird Local

Production-like experience with developer-friendly managed ClickHouse.

# Install Tinybird CLI curl https://tinybird.co | sh # Start Tinybird Local tb local start # Use clickhouse-client inside container docker exec -it tinybird-local clickhouse-client

Tinybird Local includes ClickHouse and Tinybird's tooling in a single setup. The Tinybird developer experience simplifies project management: manage schemas, queries, and deployments like software code. Use Tinybird Local for development, self-host or use the cloud offering for production.

Warning
Tinybird Local includes a ClickHouse instance, but you create tables and queries in Tinybird using a different file format (.pipe files for queries and .datasource files for tables). See the Tinybird Data Project documentation for details on Tinybird's file-based approach.

Verify Your Setup

Test your setup with a simple query:

CREATE TABLE events ( timestamp DateTime, user_id UInt64, event_type String ) ENGINE = MergeTree() ORDER BY (timestamp, user_id); INSERT INTO events VALUES ('2024-01-15 10:00:00', 1, 'click'), ('2024-01-15 10:05:00', 2, 'view'), ('2024-01-15 10:10:00', 1, 'click'), ('2024-01-15 10:15:00', 3, 'view'); SELECT event_type, count() as count FROM events GROUP BY event_type;

If this works, you're ready to proceed.

Tip
Tinybird users: You can run these SQL commands directly against the ClickHouse instance in Tinybird Local using docker exec -it tinybird-local clickhouse-client. However, the typical Tinybird workflow is to create a .datasource file and insert data using the Events API. See the Tinybird Quick Start for the standard workflow.

Generating Test Data

For performance testing and examples throughout the course, you'll need to generate large datasets. Use ClickHouse's numbers() function to generate millions or billions of rows:

-- Generate 1 million rows INSERT INTO events SELECT now() - (number * 60) as timestamp, number % 10000 as user_id, ['click', 'view', 'purchase'][number % 3 + 1] as event_type FROM numbers(1_000_000); -- Generate 1 billion rows (for performance testing) INSERT INTO events SELECT toDateTime('2024-01-01 00:00:00') + (number * 60) as timestamp, number % 1000000 as user_id, ['click', 'view', 'purchase'][number % 3 + 1] as event_type FROM numbers(1_000_000_000);

The numbers(N) function generates a sequence from 0 to N-1, which you can use with expressions to create realistic test data. Use this pattern throughout the course to test performance with large datasets.


Key Takeaways
  • Choose the right setup - ClickHouse Local for quick learning, Docker for single-node development, or Tinybird Local for production-like experience
  • Verify your setup - Run the example queries to ensure everything works before proceeding
  • Generate test data - Use numbers() function to generate millions or billions of rows for performance testing

Learn More

Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.

Setup & Prerequisites | ClickHouse for Developers