What Is an OLAP Cube? Definition and Modern Alternatives

An OLAP cube pre-aggregates data across multiple dimensions for fast analytical queries. Learn how the concept evolved into modern semantic layers and pre-aggregation caches.

9 min read

An OLAP (Online Analytical Processing) cube is a multidimensional data structure that pre-aggregates metrics across combinations of dimensions. Instead of scanning raw tables on every query, the cube stores pre-computed summaries: revenue by region by quarter, order count by product by month, average deal size by sales rep by year. Queries against the cube return in milliseconds because the heavy computation happened during the build step.

The concept dates to the 1990s. Microsoft's SSAS (SQL Server Analysis Services), Oracle OLAP, and IBM Cognos all built cube engines. Analysts defined measures (the numbers), dimensions (the axes), and hierarchies (drill paths). The cube engine pre-computed every combination and stored the results in a specialized format optimized for slice-and-dice queries.

How does an OLAP cube work?

A cube has three core components:

Measures. The numeric values you aggregate: revenue, count, average, min, max. Each measure has a fixed aggregation function. total_revenue = SUM(amount) is a measure. The cube pre-computes this sum across every combination of dimensions.

Dimensions. The axes you analyze by: time, geography, product category, customer segment. Each dimension can have a hierarchy: year → quarter → month → day. The cube pre-computes aggregates at every level of the hierarchy.

Facts. The raw rows that feed the cube. An orders fact table has one row per order. The cube reads these rows, aggregates them along every dimension combination, and stores the results.

The query flow:

Analyst: "Show me revenue by region for Q1 2026"
OLAP cube: looks up pre-computed result for (measure=revenue, region=*, quarter=Q1-2026)
Result: returns in milliseconds (no table scan)

This is fast because the aggregation happened at build time, not query time. The tradeoff: the cube must be rebuilt whenever source data changes. For large datasets, rebuilds can take hours.

OLAP vs OLTP

OLAP and OLTP are two fundamentally different approaches to working with data. Most systems need both, but they serve different purposes and have different performance characteristics.

OLTP (Online Transaction Processing) handles the day-to-day operations of your application: creating orders, updating user profiles, processing payments. Queries touch one or a few rows at a time. Speed comes from indexes on primary keys. PostgreSQL, MySQL, and SQL Server are OLTP databases.

OLAP (Online Analytical Processing) handles analytical questions about your data: total revenue this quarter, average order value by region, year-over-year growth rates. Queries scan millions of rows and aggregate them. Speed comes from columnar storage and pre-computation. Snowflake, BigQuery, ClickHouse, and Redshift are OLAP-oriented warehouses.

OLAP OLTP
Purpose Analytical queries (aggregations, trends, comparisons) Transactional operations (inserts, updates, deletes)
Query pattern Read-heavy, scan millions of rows Read-write, touch individual rows
Data model Star or snowflake schema (fact + dimension tables) Normalized (3NF)
Response time Milliseconds (pre-aggregated) to seconds (full scan) Milliseconds (indexed lookups)
Optimization Columnar storage, pre-aggregation, partitioning Indexes, row-level locking, WAL
Data freshness Batch or near-real-time (ETL/ELT pipeline) Real-time (direct writes)
Concurrency Fewer queries, heavier computation per query Many queries, light computation per query
Typical users Analysts, dashboards, AI agents, reports Applications, APIs, user-facing features
Examples "Revenue by region last quarter" "Update order #12345 status to shipped"
Databases Snowflake, BigQuery, ClickHouse, Redshift, DuckDB PostgreSQL, MySQL, SQL Server, MongoDB

In a modern data stack, your application writes to an OLTP database (PostgreSQL). An ETL/ELT pipeline copies data to an OLAP warehouse (Snowflake, BigQuery). A semantic layer sits on top of the warehouse, defining business metrics and serving them to dashboards, AI agents, and applications. Pre-aggregation adds OLAP-cube-speed caching without dedicated cube infrastructure.

The key insight: you don't choose between OLAP and OLTP. You use both. OLTP for your application. OLAP for your analytics. The semantic layer bridges the two by making analytical data accessible to every consumer without them needing to understand the warehouse.

Why did traditional OLAP cubes decline?

Traditional OLAP cubes had real limitations:

Rigid schemas. Adding a new dimension meant rebuilding the entire cube. In a fast-moving business where new metrics appear weekly, this rigidity was a bottleneck.

Cube explosion. Every dimension combination multiplies storage. 10 dimensions with 100 values each creates 100 billion potential cells. Most are empty, but the combinatorial growth makes full pre-computation impractical for high-cardinality dimensions.

Proprietary tooling. SSAS cubes only worked with Microsoft tools. Oracle OLAP only worked with Oracle BI. The cube was locked to the vendor's ecosystem.

Slow rebuilds. Full cube rebuilds on large datasets took hours. Incremental refresh helped but added complexity. Near-real-time analytics was difficult.

No programmatic access. OLAP cubes were designed for analysts using GUI tools, not for APIs, SDKs, or AI agents. Getting data out of a cube into a custom application required MDX queries through proprietary connectors.

Cloud data warehouses (Snowflake, BigQuery, Redshift) solved the raw performance problem. They can scan billions of rows in seconds. But "seconds" isn't "milliseconds." For interactive dashboards, embedded analytics, and AI agents making dozens of queries per interaction, you still need a caching layer.

The modern equivalent: semantic layers with pre-aggregation

Modern semantic layers take the best idea from OLAP cubes (pre-computed aggregations for fast queries) and drop the worst parts (rigid schemas, proprietary tooling, full rebuilds).

Instead of a dedicated cube server, you define pre-aggregation rules in YAML alongside your metric definitions:

cubes:
  - name: orders
    sql_table: public.orders
    measures:
      - name: total_revenue
        sql: "CASE WHEN status != 'refunded' THEN amount ELSE 0 END"
        type: sum
      - name: order_count
        type: count
    dimensions:
      - name: category
        sql: category
        type: string
      - name: region
        sql: region
        type: string
      - name: created_at
        sql: created_at
        type: time

    pre_aggregations:
      - name: daily_revenue
        measures:
          - total_revenue
          - order_count
        dimensions:
          - category
          - region
        time_dimension: created_at
        granularity: day
        refresh_key:
          every: 1 hour

The semantic layer builds materialized tables for the specified combinations. Queries that match a pre-aggregation hit the cache (single-digit milliseconds). Queries that don't match fall through to the warehouse (seconds). You choose which combinations to cache based on query patterns.

What's different from traditional OLAP:

Traditional OLAP cube Semantic layer + pre-aggregation
Schema changes Rebuild entire cube Add YAML, run bon deploy
Pre-computation All combinations Selected combinations (you choose)
Refresh Full rebuild or complex incremental Configurable per rollup (every: 1 hour)
Access MDX queries via proprietary tools REST API, SDK, AI agents via MCP, React SDK
Multi-tenancy Not built in Security context with row-level filtering
Version control Not supported YAML in Git, PR reviews, bon diff
Vendor lock-in SSAS, Oracle, IBM Warehouse-agnostic (Snowflake, BigQuery, PostgreSQL, Databricks)

The pre-aggregation cache gives you OLAP-cube performance. The semantic layer gives you governance, multi-tenancy, and multi-surface serving that traditional OLAP never had.

When do you still need OLAP-style pre-aggregation?

Pre-aggregation matters when:

  • Interactive dashboards. Users expect sub-second response. Warehouse query times of 2-5 seconds feel slow.
  • AI agent queries. Agents make 5-10 queries per interaction. Latency multiplies. Pre-aggregation keeps the conversation fluid.
  • Embedded analytics. Your B2B customers expect their analytics to load as fast as the rest of your product.
  • High-cardinality dimensions. Queries across millions of distinct values need caching to stay fast.
  • Cost optimization. On usage-based warehouses (BigQuery, Snowflake), every query costs money. Serving from cache is essentially free.

You don't need pre-aggregation when:

  • Queries are infrequent (a few per day)
  • Your warehouse is fast enough for the latency requirements
  • The dataset is small enough that raw queries return in milliseconds

Frequently asked questions

What does OLAP stand for?

Online Analytical Processing. "Online" means interactive (as opposed to batch). "Analytical" means aggregation queries (sums, counts, averages across dimensions) rather than transactional operations (inserts, updates, deletes). "Processing" means computation. OLAP systems are designed for fast analytical queries over large datasets.

What is an OLAP cube in simple terms?

An OLAP cube is a pre-computed summary of your data organized by multiple dimensions. Instead of calculating "revenue by region by quarter" on every query, the cube calculates it once and stores the result. Queries look up the answer instead of computing it, which makes them fast.

Is Snowflake an OLAP database?

Snowflake is a cloud data warehouse optimized for analytical (OLAP-style) queries. It doesn't use traditional cube structures but achieves fast analytical performance through columnar storage, automatic clustering, and massive parallel processing. For OLAP-cube-speed responses, you can add a pre-aggregation cache on top of Snowflake.

What is the difference between OLAP and a semantic layer?

An OLAP cube pre-computes data for fast queries. A semantic layer defines what metrics mean and governs who can query them. Modern semantic layers include pre-aggregation (the caching benefit of OLAP) plus metric definitions, access control, multi-tenancy, and API serving. A semantic layer is a superset: OLAP-style performance with governance on top.

Are OLAP cubes still used?

Traditional OLAP cube servers (SSAS, Oracle OLAP) have largely been replaced by cloud warehouses. But the concept of pre-aggregated data for fast queries is more relevant than ever. Modern implementations use pre-aggregation caches built into semantic layers rather than standalone cube servers.

What is MDX?

MDX (Multidimensional Expressions) is the query language for traditional OLAP cubes. Think of it as SQL for cubes. It's been largely replaced by standard SQL against cloud warehouses, and by JSON/REST APIs in modern semantic layers.

Related terms

Governed metrics for every surface.

Define your semantic layer in YAML. Query it from any AI agent, dashboard, or SDK. Ship analytics your customers can trust.