Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions doc/user/content/headless/materialize-window-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
headless: true
---
For indexed views and materialized views that contain [window
functions](/sql/functions/#window-functions) (including aggregate functions used
with an `OVER` clause), when an input record in a partition is
added/removed/changed, Materialize **recomputes the results from scratch** for
that partition (instead of using incremental computation).
Copy link
Copy Markdown
Contributor Author

@kay-kim kay-kim May 19, 2026

Choose a reason for hiding this comment

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

I did remove the example blurb about 10 partitions with 100 records because it kind of the work is proportional to running the window function over 1000 records instead of 10 x (window function over 100) which depending on the window function could be more than running window function over 1000 records.


The `PARTITION BY` clause of your window function determines your partitions. If
`PARTITION BY` is omitted, all records belong to a single partition (i.e., any
record change results in a recomputation from scratch over the whole input).

To avoid performance issues that may arise as the number of records grows,
consider rewriting your indexed views and materialized views to use idiomatic
Materialize SQL instead of window functions. If your view definitions cannot be
rewritten without the window functions and the performance of window functions
is insufficient for your use case, please [contact our team](/support/).
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ performance.

### Materialize and window functions

{{< idiomatic-sql/materialize-window-functions >}}
{{% include-headless "/headless/materialize-window-functions" %}}

{{</ callout >}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ can provide better performance.

### Materialize and window functions

{{< idiomatic-sql/materialize-window-functions >}}
{{% include-headless "/headless/materialize-window-functions" %}}

{{</ callout >}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ to some ordering, in each group.

### Materialize and window functions

{{< idiomatic-sql/materialize-window-functions >}}
{{% include-headless "/headless/materialize-window-functions" %}}

{{</ callout >}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function.

### Materialize and window functions

{{< idiomatic-sql/materialize-window-functions >}}
{{% include-headless "/headless/materialize-window-functions" %}}

{{</ callout >}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ to some ordering, in each group.

### Materialize and window functions

{{< idiomatic-sql/materialize-window-functions >}}
{{% include-headless "/headless/materialize-window-functions" %}}

{{</ callout >}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function.

### Materialize and window functions

{{< idiomatic-sql/materialize-window-functions >}}
{{% include-headless "/headless/materialize-window-functions" %}}

{{</ callout >}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ elements within each group according to some ordering.

### Materialize and window functions

{{< idiomatic-sql/materialize-window-functions >}}
{{% include-headless "/headless/materialize-window-functions" %}}

{{</ callout >}}

Expand Down
2 changes: 1 addition & 1 deletion doc/user/data/explain_plan_operators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ operators:
1. `Distinct GroupAggregate` corresponds to the SQL `DISTINCT` operator.
2. `Accumulable GroupAggregate` (e.g., `SUM`, `COUNT`) corresponds to several easy to implement aggregations that can be executed simultaneously and efficiently.
2. `Accumulable GroupAggregate` (e.g., `SUM`, `COUNT`) corresponds to several easy to implement aggregations that can be executed efficiently.
3. `Hierarchical GroupAggregate` (e.g., `MIN`, `MAX`) corresponds to an aggregation requiring a tower of arrangements. These can be either monotonic (more efficient) or bucketed. These may benefit from a hint; [see `mz_introspection.mz_expected_group_size_advice`](/reference/system-catalog/mz_introspection/#mz_expected_group_size_advice).
These may either be bucketed or monotonic (more efficient).
Expand Down
2 changes: 1 addition & 1 deletion doc/user/data/sql_funcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@
ROW`.
{{< note >}}
{{% idiomatic-sql/materialize-window-functions %}}
{{% include-headless "/headless/materialize-window-functions" %}}
See [Idiomatic Materialize SQL](/transform-data/idiomatic-materialize-sql/)
for examples of rewriting window functions.
Expand Down

This file was deleted.

Loading