Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 19 min read How-to mediumAdept

Replacing the HDB: ClickHouse for historical ticker data

ClickHouse can serve as the historical tier (HDB) of a market data system, a low-risk place to adopt a new database. Its columnar storage with dictionary, delta and run-length encodings plus ZSTD/LZ4 compresses tick data well. A worked example loads one month of Binance USD-M futures data (373M trades and about 2B quotes) with clickhouse-local, reading zipped CSVs directly. Plain SQL then handles trading-desk queries: VWAP, hourly OHLC candles and minute-level drill-downs run in tens of milliseconds, and ASOF JOIN matches each trade to the prevailing quote to measure slippage during a sell-off.

Assumes: SQL basicscolumnar databasesmarket data concepts

Related posts

  • NYC Meetup Report: Large Scale Financial Market Analytics with ClickHouse (Bloomberg)

    ClickHouse easyNovice

    Bloomberg's Structured Products team uses ClickHouse to power a Terminal application where a few users run interactive filter-and-group queries across roughly 100 million securities. The dataset is about 5 billion rows and 100 columns. Columnar storage keeps rarely used columns available without holding them in memory. The team prioritized ingestion over query speed: they build a new table for each change, such as adding a column, and stage data through buffer tables, which lets them load 4 TB in under an hour while keeping data fresh. Every query puts load on ZooKeeper, a single point of failure the team tests with disaster-recovery drills, and they plan to try Kubernetes, S3-backed storage and ClickHouse Keeper.

  • Trade secrets: How Coinhall uses ClickHouse to power its blockchain data platform

    ClickHouse easyNovice

    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.

  • Longbridge Technology simplifies their architecture and achieves 10x performance boost with ClickHouse

    ClickHouse mediumAdept

    Longbridge, a Singapore online brokerage, replaced a fragmented market-data stack of PostgreSQL (historical), Redis (real-time) and DynamoDB (high-write) with ClickHouse after evaluating it against TimescaleDB and TDengine for write throughput, Decimal support, time functions and aggregations. Historical data was migrated via ClickHouse external tables over OSS and Alibaba Cloud DTS, which merged 128 PostgreSQL sub-tables into one table and converted varchar fields to Decimal; Redis was kept for real-time data with ticker-level writes moved to ClickHouse. Reported results include about 5x compression (500GB down to 100GB), 10x faster single-table writes than PostgreSQL, and built-in aggregation and window functions replacing scheduled statistics jobs.

  • How Bullet uses ClickHouse Cloud to give DeFi's fastest exchange real-time analytics

    ClickHouse mediumAdept

    Bullet, a Rust-based DeFi perpetuals exchange running as an app-specific rollup on Solana with ~500μs p50 order processing, indexes 150M+ rows per hour of sequencer events into ClickHouse Cloud for trade history, real-time analytics and monitoring. Events flow from a Rust WebSocket indexer through Kafka (AWS MSK), where Redpanda Connect classifies and routes them into per-event-type ClickHouse tables; ReplacingMergeTree keyed on event number and transaction hash makes the pipeline idempotent so reindexing and backfills deduplicate automatically. Moving off Databricks removed an hourly-batch-to-DynamoDB serving layer, cut query latency from 10-15 seconds to milliseconds, and replaced a 20-30 minute leaderboard cron job with a refreshable materialized view running every 10 minutes. Data freshness improved from 1-2 hours to under 5 seconds at comparable cost with 1,000x more data.

  • Behind the music: How Chartmetric is scaling music analytics with ClickHouse

    ClickHouse mediumAdept

    Chartmetric moved time-series and playlist workloads from Postgres and Snowflake to ClickHouse Cloud, cutting RDS storage from 28 TB to 18 TB and bringing queries that timed out at 60 seconds down to under 3 seconds. Projections, one sorted by recent modification and one by ISRC, fixed hourly sync jobs that had been timing out on tables ordered for API access. Replacing large JOINs with WHERE + IN filters and LIMIT/OFFSET batching cut one query from a 30 GB out-of-memory failure to 98 ms and 300 MB. The playlist cache, built on VersionedCollapsingMergeTree, now holds 5.5B rows in 340 GB, refreshes every five minutes, and answers top-artist queries in about 1.5 seconds versus 20 in Snowflake.

The quest for software engineering knowledge.

Look:
Layout: