Skip to content

Materialized Views

Materialized Views


Overview

HeliosDB’s materialized views provide automatic query optimization through pre-computed result caching with intelligent refresh strategies and transparent query rewriting. Materialized views significantly accelerate read-heavy workloads by storing pre-computed query results that are automatically kept up-to-date.

Key Capabilities

CapabilityDescriptionBenefit
Incremental RefreshUpdate only changed data10-100x faster refresh
Flexible SchedulingManual, on-commit, interval, cronMatch any workload pattern
Query RewritingAutomatic view substitutionTransparent optimization
Multiple Storage BackendsLSM, Memory, Columnar, HybridOptimized for use case
Join EliminationPre-compute expensive joinsOrder of magnitude speedup
Aggregation PushdownPre-compute aggregationsReal-time analytics

Architecture

Materialized Views Architecture
┌─────────────────────────────────────────────────────────────────────┐
│ Query Layer │
│ ┌─────────────┐ ┌──────────────────┐ ┌─────────────────────┐│
│ │ SQL Parser │ -> │ Query Rewriter │ -> │ Query Executor ││
│ └─────────────┘ └──────────────────┘ └─────────────────────┘│
└──────────────────────────────┬──────────────────────────────────────┘
│
v
┌─────────────────────────────────────────────────────────────────────┐
│ Materialized View Manager │
│ ┌───────────────┐ ┌─────────────────┐ ┌────────────────────────┐│
│ │ View Registry │ │ Refresh Manager │ │ Dependency Tracker ││
│ └───────────────┘ └─────────────────┘ └────────────────────────┘│
└──────────────────────────────┬──────────────────────────────────────┘
│
v
┌─────────────────────────────────────────────────────────────────────┐
│ Storage Layer │
│ ┌─────────┐ ┌─────────┐ ┌───────────┐ ┌────────────────────────┐│
│ │ LSM │ │ Memory │ │ Columnar │ │ Hybrid ││
│ └─────────┘ └─────────┘ └───────────┘ └────────────────────────┘│
└─────────────────────────────────────────────────────────────────────┘

Feature Highlights

1. Incremental Refresh

Efficiently update views by processing only changed data.

2. Flexible Refresh Strategies

StrategyUse CaseLatency
ManualDevelopment, testingOn-demand
OnCommitReal-time requirementsMilliseconds
IntervalRegular updatesSeconds to minutes
CronScheduled updatesAny schedule

3. Intelligent Query Rewriting

Automatically substitute materialized views to accelerate queries:

  • Exact Match: Query matches view definition
  • Join Elimination: View pre-computes expensive joins
  • Aggregation Pushdown: View pre-computes aggregations
  • Superset Match: View contains query data plus more
  • Filter Pushdown: View has beneficial filters

Performance Benefits

The figures below are indicative, measured on representative fixtures; reproduce on your own hardware.

ScenarioWithout MVWith MVSpeedup
Complex Join500ms5ms100x
Large Aggregation2s10ms200x
Dashboard Query800ms8ms100x
OLAP Analytics5s50ms100x

Use Cases

Use CaseRecommended StrategyDescription
Real-time DashboardsOnCommitInstant updates
Daily ReportsCron (midnight)Scheduled refresh
Session AnalyticsInterval (5min)Near-real-time
Historical AnalysisManualOn-demand refresh

See Also: HeliosDB Feature Index