Docs / Databases / How to Install and Use ClickHouse for Analytics

How to Install and Use ClickHouse for Analytics

By Admin · Mar 1, 2026 · Updated Apr 24, 2026 · 28 views · 2 min read

How to Install and Use ClickHouse for Analytics

ClickHouse is a column-oriented database optimized for real-time analytical queries. Install it on your Breeze to handle large-scale analytics workloads with exceptional query performance.

Install ClickHouse

sudo apt install -y apt-transport-https ca-certificates
curl -fsSL https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key | \
  sudo gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] \
  https://packages.clickhouse.com/deb stable main" | \
  sudo tee /etc/apt/sources.list.d/clickhouse.list

sudo apt update
sudo apt install -y clickhouse-server clickhouse-client
sudo systemctl enable --now clickhouse-server

Create a Database and Table

clickhouse-client

CREATE DATABASE analytics;
USE analytics;

CREATE TABLE page_views (
    event_date Date,
    event_time DateTime,
    url String,
    user_id UInt64,
    response_time UInt32
) ENGINE = MergeTree()
ORDER BY (event_date, url);

Insert and Query Data

INSERT INTO page_views VALUES
  ('2026-03-01', '2026-03-01 10:00:00', '/home', 1001, 120),
  ('2026-03-01', '2026-03-01 10:01:00', '/api/data', 1002, 45);

-- Aggregate query runs in milliseconds
SELECT url, count() AS hits, avg(response_time) AS avg_ms
FROM page_views
WHERE event_date = '2026-03-01'
GROUP BY url
ORDER BY hits DESC;

Performance Tips

Use the MergeTree family of table engines for best performance. Partition large tables by date and choose an ORDER BY key that matches your most common query filters. ClickHouse on a Breeze can process billions of rows per second for analytical queries.

Was this article helpful?