cube-js / cube-js/cube

Caching of pre-aggregations doesn't happen in CubeCloud

Open
#6,415 2 comments 1 reaction 0 assignees View on GitHub
pre-aggregations question
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
Queries don't cache when hitting pre-aggregations

**To Reproduce**
Steps to reproduce the behavior:
1. Build a cube model that uses a pre-aggregate.
2. Fire a query that hits a pre-aggregate (Playground or API)
3. Fire the same query again (should hit cache)
4. Look at the Cubecloud query history and confirm that no cached AND pre-aggregated queries are fired.

**Expected behavior**
I'd expect when firing the same pre-aggregated query twice that it would hit the cache the second time. This works without the pre-aggregation added to the Cube model.

**Screenshots**
Screen Shot 2023-04-11 at 11 28 54 AM

**Minimally reproducible Cube Schema**

```javascript
cube(`Orders`, {
sql: `
select 1 as id, 100 as amount, 'new' status
UNION ALL
select 2 as id, 200 as amount, 'new' status
UNION ALL
select 3 as id, 300 as amount, 'processed' status
UNION ALL
select 4 as id, 500 as amount, 'processed' status
UNION ALL
select 5 as id, 600 as amount, 'shipped' status
`,
measures: {
count: {
type: `count`,
},
totalAmount: {
sql: `amount`,
type: `sum`,
},
toRemove: {
type: `count`,
},
},
preAggregations: {
main: {
measures: [
count,
]
},
}
});

```
**Sample data above (top/last 3 queries without pre-agg, others with pre-agg)**
Screen Shot 2023-04-11 at 4 11 13 PM

**Real data**
Screen Shot 2023-04-11 at 4 23 37 PM

**Version:**
Stable (0.31.55)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.