Skip to content

(WIP): Replace MV tutorial#34807

Merged
maheshwarip merged 14 commits intomainfrom
altermv-tutorial
Feb 5, 2026
Merged

(WIP): Replace MV tutorial#34807
maheshwarip merged 14 commits intomainfrom
altermv-tutorial

Conversation

@maheshwarip
Copy link
Copy Markdown
Contributor

@maheshwarip maheshwarip commented Jan 23, 2026

Tutorial for replacement materialized views

@maheshwarip maheshwarip marked this pull request as ready for review January 26, 2026 20:28
@maheshwarip maheshwarip requested a review from a team as a code owner January 26, 2026 20:28

{{< note >}}

{{% include-headless "/headless/replacement-views/querying-replacement-view" %}}
Copy link
Copy Markdown
Contributor

@kay-kim kay-kim Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figure people would query their replacement to check. we can place this somewhere else .. but eh.

[resizing your clusters](/sql/alter-cluster/#resizing) to a larger size before
applying the replacement. This helps ensure sufficient memory is available while
the diff is being processed, and will prevent out of memory errors.
the diff is being processed and will prevent out of memory errors.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could tweak this to specific clusters ... but eh.

the diff is being processed and will prevent out of memory errors.

You can resize back down after the replacement is complete. To automate this
process, you can consider using [mz-clusterctl](https://github.com/MaterializeInc/mz-clusterctl),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, just wondering ... since in the mz-clusterctl readme, we do state it's experimental.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this in personally!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 no objection ... more just wanted to clarify our product stance 😄

process, you can consider using [mz-clusterctl](https://github.com/MaterializeInc/mz-clusterctl),
which will auto-scale cluster sizes based on cluster activity.

### Use separate clusters for replacements
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion in person yesterday ... we don't want to do this.

If people want to use the create replacement/apply replacement as a way to move cluster for a mv ... that will be a different use case.

The original and replacement materialized views must have compatible schemas.
This includes having identical columns, column order, and constraints.

### Transactions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of things aren't currently supported in transactions ... so, this is no different.


## Limitations

### Schema compatibility
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh ... removed ... since we already mention it above and people cannot create a replacement with different schema ... as such, the original and replacement mv will have compatible schemas.

```


### Dropping a replacement
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to best practices for unused replacement below 97c967f#diff-efce666a496656c8382f08006cb2bdcb819b9167aacd83a40876168ec95dc128R347

-- The lowest_winning_bid should be greater than 50
SELECT * FROM auction_house.mv_org_leaderboard
ORDER BY total_spent DESC
LIMIT 5;
Copy link
Copy Markdown
Contributor

@kay-kim kay-kim Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tweaked ... since people didn't query the leaderboard before, just ordering by total_spent doesn't really verify anything.

Once the replacement materialized view is fully hydrated, apply it.
When you apply the view, Materialize calculates the diff between the
original and the replacement. At this point, the diff is applied
to the original view, along with all downstream objects.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed per clarification.

@maheshwarip maheshwarip requested a review from kay-kim February 4, 2026 22:10
@maheshwarip
Copy link
Copy Markdown
Contributor Author

my best friend, the linter, is unhappy - let me fix this

@maheshwarip
Copy link
Copy Markdown
Contributor Author

Ok finally ready for re-review @kay-kim

Copy link
Copy Markdown
Contributor

@kay-kim kay-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we add the available starting in v26.10, in the public preview blurbs, we should be good to go since:

@maheshwarip maheshwarip merged commit 313fa43 into main Feb 5, 2026
10 checks passed
@maheshwarip maheshwarip deleted the altermv-tutorial branch February 5, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants