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

Only check MV on ALTER when necessary #48062

Merged

Conversation

Algunenano
Copy link
Member

@Algunenano Algunenano commented Mar 27, 2023

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

  • Only check dependencies if necessary when applying ALTER TABLE queries.

Documentation entry for user-facing changes

Since forever (all supported releases), when CH wants to do an ALTER over a table it calls getDependentViewsByColumn to check the columns used by dependencies (materialized views, etc). My guess is that in order to avoid calling this multiple times in an execution it was moved outside of the loop, but this means that unrelated alters might check dependencies which can be really expensive.

For example, if you modify a table TTL and that table has 100 MV pending from it you will have 100 checks which are unnecessary.

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-performance Pull request with some performance improvements label Mar 27, 2023
@Algunenano
Copy link
Member Author

AST Fuzzer -> #48148

@yakov-olkhovskiy yakov-olkhovskiy self-assigned this Mar 29, 2023
@yakov-olkhovskiy yakov-olkhovskiy merged commit 35e9e45 into ClickHouse:master Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-performance Pull request with some performance improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants