cube-js / cube-js/cube

Preaggregation table could not be found when queries are made. (postgres backend)

Open
#2,855 1 comment 0 reactions 0 assignees View on GitHub
driver:postgres pre-aggregations
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
The preaggregation table for the postgres based schema are missing in some cases. and when attempting to query we see the following error message in the cubejs logs.

```
error: table "downmet_main20210527_c10ro1io_punrmxgc_1gb2ogu" does not exist
at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.stream.on (/app/node_modules/pg-protocol/dist/index.js:10:42)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
```

**To Reproduce**
Steps to reproduce the behavior:
1. Create a schema file with postgres backend
2. Add a preaggregation on the originalSql (not rollup)
3. Run the server and issue some queries to the schema having the preagg and let the server run for some time.

**Expected behavior**
Not expect to see the table for preagg missing when other tables with similar date string on the same cube with more or less same number of letters in table name are created and maintained.
**Screenshots**
Screen Shot 2021-05-28 at 3 38 11 PM

**Version:**
0.26.56

**Additional context**
The preaggregation schema name is a custom one and schema_name.table_name sometimes exceeds the 64 bytes limit in postgres. table_name alone is well within the limit.
Also there are around 1700 tables in the preaggregation schema.Multiple tables for each day with random hash strings are common.

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.