# ClickHouse

> Managed ClickHouse for analytics, event data, and large append-heavy datasets.

ClickHouse is Watasu's analytical database. Reach for it when you have lots of append-only data and you want to slice and aggregate it fast.

Don't use it as a replacement for [PostgreSQL](https://docs.watasu.io/addons/postgresql.md) — it's not built for OLTP workloads and you'll hate it for that.

## Good fits

* product analytics events
* audit logs at scale
* time-series data
* dashboards over millions or billions of rows
* exploratory analytics where wide aggregations need to return in seconds

## Plan tiers

Three tiers with a real operational gap between Hobby and Standard:

* **Hobby 0–2** — single node, **network-backed storage**, no replication. Explicitly non-production; manual backups only. For development, exploration, and small staging.
* **Standard 0–2** — 1 shard × 2 replicas across two German zones, **local NVMe**, scheduled backups by default.
* **Premium 0–2** — multi-shard with 2 replicas per shard, distributed tables across the same two zones, local NVMe, scheduled backups.

Hobby → Standard isn't just bigger; it's a fundamentally different topology (single-node → replicated) and a different storage backend (network PVC → local NVMe).

## Create

```bash
watasu addons:create clickhouse --app my-app
```

After attachment, your app receives ClickHouse connection details as config vars. Use any standard ClickHouse client library.

## Open an interactive session

```bash
watasu clickhouse:cli --app my-app
```

## Backups

ClickHouse supports manual backups, scheduled backups on supported plans, and restore from managed backups or uploaded archives.

### Capture

```bash
watasu addons:backups:capture analytics-db
```

### Restore

```bash
watasu addons:restore analytics-db ./warehouse-backup.zip --name analytics-db-restored
watasu addons:promote analytics-db-restored
```

See [Backups and Restores](https://docs.watasu.io/workflows/backups-and-restores.md) for the full workflow.

## Tips

* Keep ClickHouse separate from your transactional database. Mixing dashboards and OLTP on one engine ends badly for both.
* Validate your restore process before you need it. ClickHouse archives can be large and surprises during an incident are expensive.
* Pre-aggregate where possible — ClickHouse loves materialized views.

[View this page on the web](https://docs.watasu.io/addons/clickhouse/)
