Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADAP-835: Optimize manual refresh on auto-refreshed materialized views #637

Closed
wants to merge 13 commits into from

Conversation

mikealfare
Copy link
Contributor

resolves dbt-labs/dbt-core#6911

Problem

dbt run will issue a manual refresh of a materialized view if there are no changes detected during a run. This happens regardless of whether the materialized view is setup to be automatically refreshed. If the materialized view is already scheduled to be refreshed, there is no need to insert an additional refresh. This will add cost and potentially introduce unexpected data as the refresh schedule will not match what's set with the extra refresh.

Solution

dbt will inspect the materialized view to determine if it is set to automatically refresh. If it is, and there are no changes, then dbt run will do nothing. If it is not set to automatically refresh, then dbt run will issue a refresh command.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare self-assigned this Oct 19, 2023
@cla-bot cla-bot bot added the cla:yes label Oct 19, 2023
@Fleid Fleid added enhancement New feature or request materialized_views labels Feb 15, 2024
@mikealfare mikealfare closed this Jul 17, 2024
@mikealfare mikealfare deleted the feature/materialized-views/adap-835 branch July 17, 2024 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2068] [Feature] Let's add Materialized View as a materialization, finally
2 participants