Cube Store is a purpose-built columnar storage engine that powers Cube's pre-aggregation layer. It enables sub-second query performance on datasets that would otherwise require seconds or minutes to process.

Why Pre-Aggregations Matter

In modern data stacks, raw query performance is often bottlenecked by the volume of data being scanned. As datasets grow, even well-indexed analytical databases struggle to deliver the millisecond response times that great user experiences demand.

Pre-aggregations solve this by materializing the results of common query patterns ahead of time. Instead of scanning millions of rows on every request, Cube serves the pre-computed result directly from Cube Store.

How Cube Store Works

Cube Store uses a columnar format optimized for the types of aggregations common in business intelligence workloads — sums, counts, averages, and percentiles over filtered subsets of data.

When you define a pre-aggregation in your Cube schema:

cubes:
- name: orders
pre_aggregations:
- name: main
measures:
- count
- revenue
dimensions:
- status
time_dimension: created_at
granularity: day

Cube automatically:

  1. Builds the pre-aggregation on the first query that matches the rollup
  2. Refreshes it on a configurable schedule
  3. Routes subsequent matching queries to Cube Store instead of your source database

Performance Characteristics

Cube Store is designed to handle hundreds of millions of rows efficiently. Typical improvements over querying your source database directly:

  • 10-100x faster query response times
  • 90%+ reduction in load on your upstream database
  • Linear scalability as pre-aggregation data grows

Getting Started

Pre-aggregations in Cube Store require no additional infrastructure when running Cube locally — Cube Store is embedded and starts automatically.

For production deployments, you can configure Cube Store with dedicated compute to ensure pre-aggregation builds don't compete with query serving:

CUBEJS_CUBESTORE_HOST=cubestore
CUBEJS_CUBESTORE_PORT=3030

Refer to the Cube documentation for detailed configuration options and schema examples.