bin_chen
06/02/2026, 2:43 PMRocky
06/02/2026, 2:43 PMdefault_catalog.
* Finding 3 (Join Sequence): Correct. The StarRocks optimizer is generally robust to join reordering. As long as the tables and join conditions are logically equivalent, the sequence in the query does not need to match the MV definition.
* Finding 4 (Join Type - INNER vs LEFT): Actually, they do not always have to match. StarRocks supports a feature called Join Derivability.
* An MV defined with a LEFT OUTER JOIN can rewrite a query using an INNER JOIN (StarRocks will automatically add a NOT NULL predicate to the result).
* Conversely, an INNER JOIN MV can sometimes rewrite a LEFT OUTER JOIN query if there are filters in the query that effectively nullify the outer join's behavior.
* However, if your MV is "complex" (falling back to text-based rewrite), then the join types must match exactly because the ASTs must match.
Summary Comparison Table
Feature | Finding | Status | Technical Detail
Complex MV Rewrite | Exact Match only | Confirmed | Complex queries fall back to "Text-based Match" which requires AST equivalence.
Simple MV Rewrite | Flexible | Confirmed | Uses SPJG algorithm for partial matches, predicate pushdown, etc.
Join Sequence | Doesn't matter | Confirmed | Optimizer handles join reordering before matching.
Join Type (Inner/Left) | Must match | Refined | For simple SPJG MVs, they can differ (Join Derivability). For complex/Text-based MVs, they must match.
For the best results with complex logic, we recommend the Nested MV approach (building simple MVs on top of other MVs), as this allows the flexible SPJG rewriter to work at multiple levels.
_Sources: StarRocks Docs - Query rewrite with materialized views_
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.mdRocky
06/02/2026, 2:45 PMdefault_catalog that rewrites queries against an iceberg_catalog.
* Joins: Correct, joins are a core part of the rewrite capability.
──────────
2. MVs on StarRocks Native Tables
* Finding 1 (Native Tables): Confirmed. This is the primary use case with the strongest consistency guarantees.
* Finding 2 (Catalog): Confirmed. While the base tables can be anywhere, the Materialized View object itself is stored in the StarRocks default_catalog.
* Finding 3 (Join Sequence): Confirmed. The StarRocks optimizer is capable of join reordering. If the query joins the same tables as the MV but in a different order, the rewrite can still succeed.
* Finding 4 (Join Types - INNER vs. LEFT): Refined (Important Correction).
* The join types do not always have to match. StarRocks supports Join Derivability:
* MV (LEFT JOIN) → Query (INNER JOIN): This works. StarRocks will automatically add a NOT NULL predicate to the rewritten query to ensure the results match an inner join.
* MV (INNER JOIN) → Query (LEFT JOIN): This can work if the query contains a filter on the "nullable" side that effectively turns the join into an inner join (null-rejecting predicates).
_ _Note:* If the MV is so complex that it falls back to Text-based rewrite, then the join types must match exactly because the query structure must be identical.
Summary
Your findings are very accurate regarding the complexity of the MV and the flexibility of simple MVs. The main correction is that Join Types are more flexible than you noted thanks to the "Join Derivability" feature in the StarRocks optimizer.
For more details, you can refer to the official Query rewrite with materialized views documentation.
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• using_starrocks/async_mv/use_cases/data_lake_query_acceleration_with_materialized_views.md
• using_starrocks/async_mv/Materialized_view.mdbin_chen
06/02/2026, 3:02 PM