Materialized Views
Create materialized views to pre-aggregate your data, based on your egress API
This demo will walk you through using Aurora tools to prompt your way to creating materialized views that pre-aggregate the aircraft telemetry data you’ve ingested.
Skip to prompt if you started with the ads-b template.
Prerequisites
- Aurora and Moose CLIs: Install them here
- OS: macOS or Linux (WSL supported for Windows)
- Docker Desktop/Engine: 24.0.0+
- Node: version 20+ (LTS recommended)
- Anthropic API Key: Get one here
- Client: Cursor
- Completed: Ingest Demo (or have data already in your system)
Start with the ads-b template
aurora init mvs-demo ads-b
cd mvs-demo
npm install
Run the Moose Dev Server
moose dev
Open the project in Cursor
Initialize the Aurora MCP
Navigate to Cursor > Settings > Cursor Settings > Tools and Integrations
then toggle on the Aurora MCP
tool.
For best results, set the LLM to claude-4-sonnet
Gemini 2.5 and o3 are also reasonably good, but claude-4-sonnet has the most consistent results.
Create an egress API
You can skip this step if you’ve already completed the Egress Demo.
Can you create an API that returns every aircraft within X miles of Y,Z coordinates.
Prompt the LLM to create a materialized view
Given the egress API, can you create a materialized view that improves the performance of the query?
Action
The LLM should now use aurora tools to:
- analyze the Moose project and the egress API
- create a Materialized View that pre-aggregates the data
You’ll know it is succeeding if:
- the LLM successfully creates the materialized view
- the LLM sees that the materialized view was created in the ClickHouse database
Optional further prompts
Can you create a new egress API that leverages the materialized view to improve the performance of the query?
Can you test both APIs to see what the performance difference is? I want to see the difference in speed, number of rows read, amount of data read, compute, and other vectors you think are pertinent.