Real-Time OLAP and Analytical Databases

Real-Time OLAP & Analytical Databases

Overview

Real-time OLAP databases are the query and storage engines that answer analytical questions (aggregations, group-bys, filters, top-N, time-series rollups) over large, continuously updating datasets with sub-second latency and high concurrency. They sit between stream processing (which transforms events in flight — da-14) and the BI/semantic layer (da-18), serving as the low-latency serving layer for dashboards, monitoring, and user/customer-facing analytics.

What makes an engine “real-time OLAP” rather than a cloud data warehouse:

This skill covers the engines and the query layer. It is the OLAP-database node of the data-analytics curriculum (da-1 onward); it does not cover stream processing (da-14), pipeline orchestration (da-13), or the metrics layer (da-18).

Core Concepts

1. Columnar storage

Data is stored by column, not by row. Analytical queries touch few columns but many rows, so columnar layout reads only the needed columns, drastically cutting I/O, and stores like-typed values together so they compress far better (delta, dictionary, RLE, LZ4/ZSTD). This is the foundational OLAP advantage over row stores (SQLFlash, 2025; Airbyte, 2024). Compression both saves storage and increases effective scan throughput.

2. Vectorized execution

Instead of processing one row at a time through a tuple-at-a-time interpreter, the engine processes batches (vectors) of column values in tight loops, exploiting CPU SIMD instructions, cache locality, and amortized virtual-function/branch overhead. This yields multi-x to order-of-magnitude speedups and is paired with columnar storage in every modern engine (SQLFlash, 2025; Cockroach Labs). Even hybrid OLTP/OLAP systems (Google Spanner’s columnar engine, OceanBase 4.3) adopt columnar + vectorized execution for analytics, up to ~200x faster on live data (InfoQ, 2025).

3. Real-time vs batch analytics (Lambda / Kappa)

4. Streaming ingestion & upserts

Real-time OLAP engines ingest directly from Kafka, Pulsar, and Kinesis. Apache Pinot transforms bytes from Kafka into queryable segments with sub-second visibility from write to query as the default; end-to-end latency under 5s is normal in production (StarTree, 2025; Confluent).

5. Materialized views & pre-aggregation

Precompute aggregates so dashboard queries hit ready answers instead of scanning raw rows.

6. Indexing & the ClickHouse MergeTree model

ClickHouse’s MergeTree family writes each INSERT as an immutable data part (one file per column + index), merged in the background.

7. Star-schema-on-OLAP & denormalization

Two camps: (a) flatten/denormalize into one wide table for fastest scans (historically favored by Druid/ClickHouse, which are weaker at large joins); (b) keep the star/snowflake schema and join at query time. StarRocks explicitly preserves star/snowflake schemas and does real-time pre-processing at load, with a strong distributed join engine, so you avoid the maintenance burden of giant denormalized tables (StarRocks features; jusdb, 2026). Rule of thumb: denormalize when joins dominate latency and the engine joins poorly; keep the star schema when the engine joins well and dimensions change.

8. Storage-compute separation / shared-data / tiered storage

Modern engines decouple cheap durable object storage (S3/GCS/Azure Blob) from elastic compute, mirroring cloud-DW architecture but for real-time workloads. StarRocks 3.0+ shared-data mode replaces storage-bearing backends with compute nodes (CN) that cache hot data and read cold data from S3, giving elastic scaling; 4.0 cut object-store API costs and reached 15-30s data freshness in this mode (StarRocks architecture; Medium/Ding, 2025). Tiered storage (hot local SSD to warm/cold object store) is now standard across ClickHouse, Druid, Pinot, and StarRocks.

9. High-QPS user-facing / customer-facing analytics

“User-facing analytics” embeds analytics in the product, exposed to end users, so every user gets personalized metrics, producing hundreds of thousands of QPS rather than a few analyst sessions (Pinot). This is the workload real-time OLAP engines exist for and where cloud DWs fail on concurrency/cost. Pinot has served 20,000+ QPS at sub-second p99 with 99.99% availability via star-tree pre-aggregation; ClickHouse powers a customer-facing feature and a BI dashboard from one service (StarTree; ClickHouse, 2025).

Tools / Frameworks

Engine Sweet spot Notable strengths Watch-outs
ClickHouse Fastest single-table aggregation; warehouse + real-time in one Vectorized engine, best compression, MergeTree indexing, 1,000+ concurrent q/node, ClickPipes CDC Joins historically weaker; eventual-consistency mutations
Apache Pinot Lowest-latency high-QPS user-facing analytics Star-tree pre-agg, upserts, real-time Kafka/Pulsar ingestion, very high QPS Operationally heavy; query flexibility narrower than full SQL DW
Apache Druid Interactive exploration, time-series, high concurrency UIs Segment + bitmap indexes, real-time + batch ingestion, instant visibility Many services to operate; joins limited
StarRocks Real-time analytics with joins on star schemas; lakehouse Cost-based optimizer, strong joins, async MVs + query rewrite, PK upserts, shared-data on S3 Younger ecosystem; cluster ops
Apache Doris MPP analytics, MV-accelerated reporting Async MVs, MySQL protocol, easier ops than some StarRocks (its fork) often faster on benchmarks
DuckDB Embedded / in-process single-node analytics Columnar+vectorized, reads Parquet/CSV/Arrow directly, zero server Not distributed, not a streaming/high-concurrency serving engine
Cloud DWs (Snowflake / BigQuery / Redshift) Batch BI, ad-hoc internal analysis, scheduled dashboards Managed, separation of storage/compute, Iceberg support Concurrency limits + cost for real-time/user-facing serving

Benchmarks (treat as directional, vendor-published): StarRocks reports ClickHouse ~2.2x and Druid ~8.9x slower on 13 SSB flat-table queries; Pinot reported 2-4x faster than Druid on some queries (StarRocks; StarTree).

Methodology — choosing & designing

  1. Classify the workload. Internal batch BI / ad-hoc to cloud DW (Snowflake/ BigQuery/Redshift) or DuckDB for single-node. User-facing / sub-second / high QPS / streaming-fresh to a real-time OLAP engine.
  2. Match engine to query shape.
    • Massive single-table aggregations, want simplicity: ClickHouse.
    • Per-user dashboards, very high QPS, fixed query shapes: Pinot (star-tree).
    • Interactive time-series exploration with high concurrency: Druid.
    • Real-time analytics needing joins on a star schema, lakehouse: StarRocks/Doris.
    • Embedded/local, no server, Parquet on disk: DuckDB.
  3. Decide the freshness path (Kappa-style streaming vs hybrid Lambda) and the mutability model (append-only vs full/partial upsert).
  4. Model the schema: denormalize for join-weak engines; keep star schema for StarRocks/Doris with strong join engines.
  5. Pre-aggregate intentionally: star-tree (Pinot) or async MVs (StarRocks/ Doris) or MV+projections (ClickHouse) for the known dashboard query shapes.
  6. Tune indexing: sort key / primary index ordered by your most selective filter; add data-skipping/bitmap indexes for secondary predicates.
  7. Right-size storage: separate storage/compute (shared-data) and tier hot to cold to control cost at scale.

Practical Patterns

Anti-Patterns

Troubleshooting

References