Skip to content

docs: Add more details to the materialized view documentation#27465

Open
bibith4 wants to merge 1 commit intoprestodb:masterfrom
bibith4:mv_document
Open

docs: Add more details to the materialized view documentation#27465
bibith4 wants to merge 1 commit intoprestodb:masterfrom
bibith4:mv_document

Conversation

@bibith4
Copy link
Copy Markdown
Contributor

@bibith4 bibith4 commented Mar 30, 2026

Description

Updated the materialized view documentation to incorporate supporting configurations and relevant examples.

Motivation and Context

To ensure consistent understanding and usage of materialized views

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

Summary by Sourcery

Expand and clarify documentation around materialized views, including their creation and refresh behavior.

Documentation:

  • Enhance admin documentation for materialized views with additional guidance and context.
  • Update SQL reference pages for CREATE MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW to include more details and examples.

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Mar 30, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 30, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Expands and clarifies the documentation for materialized views, including admin guidance, configuration details, and SQL syntax/usage for creating and refreshing materialized views.

File-Level Changes

Change Details Files
Enhance the admin guide for materialized views with configuration and operational guidance.
  • Document additional configuration options relevant to materialized views (e.g., connector and catalog-level settings).
  • Clarify lifecycle and management tasks such as creation, refresh strategies, and troubleshooting behavior.
  • Add or refine narrative sections to better explain how materialized views interact with underlying tables and queries.
presto-docs/src/main/sphinx/admin/materialized-views.rst
Expand CREATE MATERIALIZED VIEW SQL reference with richer explanations and examples.
  • Clarify required and optional clauses in the CREATE MATERIALIZED VIEW syntax.
  • Add concrete examples demonstrating common usage patterns and best practices.
  • Explain semantics such as how the defining query is stored and how dependencies on base tables are handled.
presto-docs/src/main/sphinx/sql/create-materialized-view.rst
Improve REFRESH MATERIALIZED VIEW documentation with clearer behavior and example workflows.
  • Clarify how REFRESH MATERIALIZED VIEW behaves with respect to incremental vs full refresh, concurrency, and failure scenarios (where applicable).
  • Provide example statements showing typical refresh usage in operational contexts.
  • Align terminology and cross-references with the admin and CREATE MATERIALIZED VIEW documentation for consistency.
presto-docs/src/main/sphinx/sql/refresh-materialized-view.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the docs label Mar 30, 2026
@github-project-automation github-project-automation bot moved this to 🆕 Unprioritized in Presto Documentation Mar 30, 2026
@bibith4 bibith4 requested a review from tdcmeehan March 30, 2026 09:45
@bibith4 bibith4 marked this pull request as ready for review March 30, 2026 09:45
@bibith4 bibith4 requested review from a team, elharo and steveburnett as code owners March 30, 2026 09:45
@prestodb-ci prestodb-ci requested review from a team, Joe-Abraham and anees-kt and removed request for a team March 30, 2026 09:45
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@bibith4 bibith4 changed the title Add more details to the materialized view documentation. docs: Add more details to the materialized view documentation. Mar 30, 2026
@bibith4 bibith4 changed the title docs: Add more details to the materialized view documentation. docs: Add more details to the materialized view documentation Mar 30, 2026
+=====================+=====================+=====================+=====================+==============================+
| USE_VIEW_QUERY | No | Yes | No (for queries) | Always fresh, MV ignored |
+---------------------+---------------------+---------------------+---------------------+------------------------------+
| USE_STITCHING | Partial | Yes | No (for queries) | Hybrid result |
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.

What does hybrid result mean?

SET SESSION materialized_view_skip_storage = 'USE_STITCHING';


Behavior Summary
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.

This table doesn't seem very useful beyond the doc above, let's just remove it.

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.

@tdcmeehan I have removed the Table. Please check

Comment on lines +81 to +134
Create a materialized view with staleness configuration::

``staleness_window - How long stale data is acceptable``

``USE_VIEW_QUERY``

CREATE MATERIALIZED VIEW daily_sales
WITH (stale_read_behavior = 'USE_VIEW_QUERY',
staleness_window = '1h'
) AS
SELECT date_trunc('day', order_date) AS day,
region,
SUM(amount) AS total_sales,
COUNT(*) AS order_count
FROM orders
GROUP BY date_trunc('day', order_date), region

``FAIL``

CREATE MATERIALIZED VIEW daily_sales
WITH (stale_read_behavior = 'FAIL',
staleness_window = '30m'
) AS
SELECT date_trunc('day', order_date) AS day,
region,
SUM(amount) AS total_sales,
COUNT(*) AS order_count
FROM orders
GROUP BY date_trunc('day', order_date), region

``USE_STITCHING``

CREATE MATERIALIZED VIEW daily_sales
WITH (stale_read_behavior = 'USE_STITCHING',
staleness_window = '1h'
) AS
SELECT date_trunc('day', order_date) AS day,
region,
SUM(amount) AS total_sales,
COUNT(*) AS order_count
FROM orders
GROUP BY date_trunc('day', order_date), region

``No staleness window(always stale after source changes)``

CREATE MATERIALIZED VIEW daily_sales
WITH (stale_read_behavior = 'FAIL'
) AS
SELECT date_trunc('day', order_date) AS day,
region,
SUM(amount) AS total_sales,
COUNT(*) AS order_count
FROM orders
GROUP BY date_trunc('day', order_date), region
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.

Can we just have one example? I think it's clear that there's a default value if none are provided, and that the value can be parameterized.

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.

@tdcmeehan Updated to provide only one example. Please check

@github-project-automation github-project-automation bot moved this from 🆕 Unprioritized to 🏗 In progress in Presto Documentation Mar 30, 2026
Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thank you for the documentation! A couple of nits.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Codenotify: Notifying subscribers in CODENOTIFY files for diff 52ad58a...c99d493.

No notifications.

@github-actions github-actions bot removed the docs label Apr 1, 2026
Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Just one question.

Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Just a nit of phrasing.

Copy link
Copy Markdown
Member

@hantangwangd hantangwangd left a comment

Choose a reason for hiding this comment

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

Thanks @bibith4, lgtm!

Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull updated branch, new local doc build, looks good. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs from:IBM PR from IBM

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

5 participants