Getting around the limitation on the length of schema/table name

Before I know that sqlAlias is allowed also for pre-aggregation:
Screen Shot 2021-02-14 at 3.49.39 AM

Using a very short alias name on your cube (e.g. 2-4 characters) definitely helps:
https://cube.dev/docs/cube#parameters-sql-alias

Note that the name you give the rollup in the cube config is also part of the table name, so use very short names for those as well!

There’s partitioning info and versioning also stored in the table name, so it doesn’t take much to hit the postgres limit (63 I believe).

2 Likes

And also, I recommend you guys to use a short name on indexes, too.

Because Cube.js internally manages the index name with trailing versioning keys, index names can easily exceed 63 characters. (That’s because the full relation name of the indexes are created like <schema_name>_<preagg_name>_<index_name>_<versioning_keys>.)

As you guys know, some external databases truncate the exceeded characters so that a new relation for the index collides with the old one in the end.

3 Likes