Skip to content

Conversation

@piotrrzysko
Copy link
Member

@piotrrzysko piotrrzysko commented Dec 4, 2025

Description

Analyzing the underlying query can be costly in some scenarios, especially when it references many tables. An additional benefit of skipping this analysis is improved availability - MV data sources don’t need to be reachable when accessing the MV.

Additional context and related issues

We are working on adding a WHEN STALE clause to CREATE MATERIALIZED VIEW. Relevant PRs:

The change proposed in this PR makes the definitions of the behaviors controlled by the new clause simpler and more symmetric; see this comment: #27356 (comment).

Additionally, it brings the current MV implementation closer to resolving #23387 (reply in thread) and #23747.

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## Section
* Improve performance of queries referencing fresh materialized views. ({issue}`27551`)

@cla-bot cla-bot bot added the cla-signed label Dec 4, 2025
@piotrrzysko piotrrzysko force-pushed the skip_analysis_fresh_mv branch from 03755cf to ef76b29 Compare December 4, 2025 12:01
Since 4349aa9, the
test_materialized_view_stale used in TestEventListenerBasic had not
been considered stale, because MockConnector did not treat an MV
with a storage table as stale.

This commit introduces a way to explicitly define the freshness of an
MV in MockConnector.
Analyzing the underlying query can be costly in some scenarios,
especially when it references many tables. An additional benefit of
skipping this analysis is improved availability — MV data sources don’t
need to be reachable when accessing the MV.
@piotrrzysko piotrrzysko force-pushed the skip_analysis_fresh_mv branch from ef76b29 to 2f2583f Compare December 4, 2025 12:03
@findepi
Copy link
Member

findepi commented Dec 4, 2025

(x) Release notes are required, with the following suggested text:

## Section
* Skip analysis of underlying queries for fresh materialized views. ({issue}`issuenumber`)

"Improve performance ..."

@piotrrzysko piotrrzysko marked this pull request as ready for review December 4, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants