Trade secrets: How Coinhall uses ClickHouse to power its blockchain data platform
Coinhall, an omnichain trading terminal aggregating swap data from 23 blockchains, moved from BigQuery (about 2-second queries, thousands of dollars per month) to QuestDB and then to self-hosted ClickHouse. In Coinhall's comparison against Rockset, SingleStore and Snowflake, ClickHouse ran candlestick queries in 20 ms, latest-price queries in 8 ms and ASOF JOINs in 50 ms, on a 4 vCPU / 16 GB server costing about $50 a month. After migrating, the team tuned queries around sparse primary indexes and replaced full-table LIMIT BY scans with aggregating tables fed by materialized views. They also avoided or simplified sort-merge joins.
Related posts
- Join me if you can: ClickHouse vs. Databricks vs. Snowflake - Part 1
ClickHouse easyNovice
ClickHouse Cloud ran a third-party, join-heavy coffee-shop star-schema benchmark (17 queries, originally built to compare Databricks and Snowflake) with no query rewrites or tuning, and came out faster and cheaper at every scale from 721 million to 7.2 billion rows. At the 500m scale most queries finish in under a second, 3–5× faster than the alternatives. At the 1b scale one query joins, aggregates and sorts 1.7 billion rows in half a second where the other systems take 5–13 seconds. The setup used shared-data compute warehouses with parallel replicas on 2–16 nodes, reported the best of 5 warm runs, and is reproducible from a public repo and S3 dataset.
- HIFI’s migration from BigQuery to ClickHouse
ClickHouse mediumAdept
HIFI moved music royalty analytics from BigQuery to ClickHouse because BigQuery's per-query pricing discouraged exploratory use and slot reservations didn't fit a startup's shifting workloads. Dashboard loads for accounts with 25M+ rows dropped from up to 30 seconds (with timeouts) to a few seconds. The migration surfaced ClickHouse-specific join behaviour: bulk updates work better via a Join engine table and joinGet, and LEFT joins from PostgreSQL to large ClickHouse tables can exhaust memory because the hash join loads the right side into memory, which pre-aggregating the right side with GROUP BY fixes (under 1 second). A community Node.js client also silently converted NULLs to empty strings on insert, which they patched.
- Join me if you can: ClickHouse vs. Databricks vs. Snowflake - Part 2
ClickHouse mediumAdept
Replacing fact-to-dimension joins with in-memory dictionaries in ClickHouse Cloud sped up a 17-query join benchmark over 1.4 billion rows by 1.9–3.5× in total runtime, up to 6.6× on individual queries, and cut cost by up to 60%. The Locations table becomes a complex_key_hashed dictionary for String-key lookups. The Products table becomes a range_hashed dictionary that resolves time-versioned rows with a hash map plus binary search over date ranges, provided the source has no overlapping ranges per key. Queries change only by swapping JOINs for dictGet calls, and the gains grew as the cluster scaled from 2 to 8 nodes.
- DENIC Improves Query Times By 10x with ClickHouse
ClickHouse mediumAdept
DENIC, the .de registry, built its data science platform on ClickHouse after rejecting Hadoop and Spark as too costly to administer and cloud services for privacy reasons. A denormalized ReplicatedMergeTree table stores more than 20 million per-domain time series, with holder data held in arrays. A daily query that finds the current state of domains whose holders changed took 5 minutes. Switching to a ReplicatedReplacingMergeTree table cut that to 3 minutes. An AggregatingMergeTree materialized view with argMax was dropped because it exhausted 128 GB of RAM. Rewriting the query to filter whole time series in the GLOBAL IN subquery, using LIMIT 1 BY instead of max(timestamp), and using ARRAY JOIN with IN instead of hasAny brought it to about 30 seconds, and that held at hundreds of millions of rows.
- TPC-H for less than a cent: ClickHouse Cloud vs. Snowflake, Databricks, BigQuery, and Redshift
ClickHouse easyNovice
On TPC-H SF100 (100 GB, 866M rows, 22 join-heavy queries), a single 59-core Graviton3 ClickHouse Cloud node finished hot runs in 19.8s for $0.063. Snowflake Large was faster at 15.9s but cost $0.143, and BigQuery took 26.2s for $0.163. Scoring cost × runtime puts ClickHouse first, with the nearest configurations about 2× worse and large warehouses 25–67× worse. At SF10 the full workload ran in 2.9s for under one cent. The gains come from two years of join work (hash joins, runtime filters, statistics-based join reordering) that made the workload 26× faster. Multi-node distributed joins for SF1000+ are the next focus.