DEV Community

Alex Spinov
Alex Spinov

Posted on

ClickHouse Has a Free API — Analyze Billions of Rows in Seconds

ClickHouse is the fastest open-source columnar database for analytics. With ClickHouse Cloud free tier and HTTP API, you can query billions of rows in milliseconds.

What Is ClickHouse?

ClickHouse is a column-oriented OLAP database designed for real-time analytics. Originally built by Yandex for web analytics, it now powers analytics at Cloudflare, Uber, eBay, and thousands more.

Free tier (ClickHouse Cloud):

  • 10GB storage
  • Generous compute credits
  • HTTP and native APIs
  • No credit card required

HTTP API Quick Start

# Query via HTTP
curl "https://YOUR_HOST:8443/?query=SELECT+1" \
  --user "default:YOUR_PASSWORD"

# Create table
curl "https://YOUR_HOST:8443/" \
  --user "default:YOUR_PASSWORD" \
  -d "CREATE TABLE events (timestamp DateTime, event String, value Float64) ENGINE = MergeTree() ORDER BY timestamp"

# Insert data
curl "https://YOUR_HOST:8443/?query=INSERT+INTO+events+FORMAT+JSONEachRow" \
  --user "default:YOUR_PASSWORD" \
  -d '{"timestamp":"2026-01-01 00:00:00","event":"pageview","value":1.0}'

# Query data
curl "https://YOUR_HOST:8443/?query=SELECT+count()+FROM+events" \
  --user "default:YOUR_PASSWORD"
Enter fullscreen mode Exit fullscreen mode

Use Cases

  1. Web analytics — page views, sessions, funnels
  2. Log analysis — query terabytes of logs in seconds
  3. Time series — IoT, metrics, monitoring
  4. Business intelligence — real-time dashboards
  5. Ad tech — impression/click analysis

Python Example

import clickhouse_connect

client = clickhouse_connect.get_client(
    host="YOUR_HOST", port=8443,
    username="default", password="YOUR_PASSWORD"
)

result = client.query("SELECT count() FROM events")
print(f"Total events: {result.result_rows[0][0]}")
Enter fullscreen mode Exit fullscreen mode

ClickHouse vs PostgreSQL for Analytics

Feature ClickHouse PostgreSQL
1B rows query < 1 sec Minutes
Compression 10-40x 2-3x
Columnar storage Yes No
Real-time inserts Millions/sec Thousands/sec
OLTP workloads No Yes

Need web data at scale? Check out my scraping tools on Apify or email spinov001@gmail.com for custom solutions.

Top comments (0)