@@ -103,6 +103,25 @@ cubes involved in the query.
103103- If multiple cubes are referenced in the query, the pre-aggregation should
104104include only members of these cubes.
105105
106+ ## Matching multi-fact and multi-stage queries
107+
108+ A query can decompose into multiple subqueries — for example, a query over a
109+ [ multi-fact view] [ ref-multi-fact-views ] runs a subquery per fact, and a query
110+ with [ multi-stage measures] [ ref-multi-stage ] runs a subquery per stage. Cube
111+ matches a pre-aggregation to each subquery independently, so a single query can
112+ be served by several pre-aggregations at once — one per subquery — rather than
113+ requiring a single pre-aggregation that covers the whole query.
114+
115+ <Warning >
116+
117+ Matching separate pre-aggregations to multi-fact and multi-stage subqueries is
118+ powered by Tesseract, the [ next-generation data modeling engine] [ link-tesseract ] .
119+ Tesseract is currently in preview. Use the
120+ [ ` CUBEJS_TESSERACT_SQL_PLANNER ` ] [ ref-tesseract-env ] environment variable to
121+ enable it.
122+
123+ </Warning >
124+
106125## Troubleshooting
107126
108127If you're not sure why a query does not match a pre-aggregation, try to identify
@@ -137,7 +156,11 @@ configuration option.
137156[ ref-non-strict-date-range-match ] : /reference/data-modeling/pre-aggregations#allow_non_strict_date_range_match
138157[ ref-non-additive-recipe ] : /recipes/pre-aggregations/non-additivity
139158[ ref-conf-scheduled-refresh-time-zones ] : /reference/configuration/config#scheduled_refresh_time_zones
140- [ ref-ungrouped-queries ] : /reference/queries#ungrouped-query
159+ [ ref-ungrouped-queries ] : /reference/core-data-apis/ queries#ungrouped-query
141160[ ref-primary-key ] : /reference/data-modeling/dimensions#primary_key
142161[ ref-custom-granularity ] : /reference/data-modeling/dimensions#granularities
143- [ ref-views ] : /docs/data-modeling/views
162+ [ ref-views ] : /docs/data-modeling/views
163+ [ ref-multi-fact-views ] : /docs/data-modeling/multi-fact-views
164+ [ ref-multi-stage ] : /docs/data-modeling/measures#multi_stage
165+ [ ref-tesseract-env ] : /reference/configuration/environment-variables#cubejs_tesseract_sql_planner
166+ [ link-tesseract ] : https://cube.dev/blog/introducing-tesseract
0 commit comments