z-go-clickhouse
Installation
SKILL.md
ClickHouse from Go
ClickHouse is append-only columnar OLAP, not a row store. Every habit carried over from Postgres costs correctness or throughput until unlearned.
OLTP habits that don't transfer
| Postgres habit | ClickHouse reality |
|---|---|
UPDATE/DELETE a row |
ALTER TABLE ... UPDATE/DELETE is a heavyweight async mutation — it rewrites whole parts in the background, not a row-level op. Model changes as a new versioned row instead (ReplacingMergeTree). |
Row-by-row INSERT in a request handler |
Every INSERT creates a new part on disk. One insert per event outruns the background merge scheduler within minutes. Batch or use async_insert. |
| Multi-statement transaction | No cross-statement transactions, no row-level locks. Each inserted block is atomic on its own; that's the whole guarantee. |
| Point lookup on a B-tree PK | ORDER BY is a sparse primary index (one entry per 8192-row granule by default) — a "point lookup" still scans a granule, and only helps if the filtered column is a prefix of ORDER BY. |
For genuinely transactional, row-level, low-latency lookups keep that data in Postgres — see [[z-go-database]]. ClickHouse is for aggregation over large append-only fact tables (events, bookings history, pricing snapshots), not the system of record.