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

Automatically refresh materialized views #4461

Merged
merged 2 commits into from
Mar 16, 2023
Merged

Automatically refresh materialized views #4461

merged 2 commits into from
Mar 16, 2023

Conversation

lutter
Copy link
Collaborator

@lutter lutter commented Mar 15, 2023

We have some materialized views that contain information about the size of various things in the database. So far, they had to be refreshed manually and could therefore fall out of sync by a lot.

With this change, they get refreshed automatically every 6 hours. For very large databases, a refresh takes a little over a minute.

async fn run(store: &DeploymentStore) -> Result<(), StoreError> {
// We hardcode our materialized views, but could also use
// pg_matviews to list all of them, though that might inadvertently
// refresh materialized views that user created themselves
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// refresh materialized views that user created themselves
// refresh materialized views that operators created themselves

@lutter lutter merged commit fb86686 into master Mar 16, 2023
@lutter lutter deleted the lutter/matviews branch March 20, 2023 19:08
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