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

inspect.getCandidateUniqueKeys avoidably slow on large schemas #698

Closed
twotwotwo opened this issue Jan 22, 2019 · 1 comment
Closed

inspect.getCandidateUniqueKeys avoidably slow on large schemas #698

twotwotwo opened this issue Jan 22, 2019 · 1 comment

Comments

@twotwotwo
Copy link
Contributor

I'm looking at gh-ost for use on a multitenant app where we have tens thousands of tables on one server. Because number of tables and columns, a couple of inspect.go INFORMATION_SCHEMA queries take more than a minute.

It looks like for getCandidateUniqueKeys' big query, the slowness is easy to fix: the ON clause on the join checks that TABLE_SCHEMA and TABLE_NAME match, when that isn't necessary because in the inner and outer queries both check for the right TABLE_NAME and TABLE_SCHEMA in their WHERE clauses. Without those additional conditions, MySQL 5.6 is able to run the query in seconds.

Without the change we'd spend hours just on gh-ost startup time on every migration. With that change and -skip-foreign-key-checks, it's much more workable for us. I have a simple change ready that I'll submit as a PR; writing here because the PR instructions suggest starting discussions on issues.

@shlomi-noach
Copy link
Contributor

closed by #699 and #701 . Thank you!

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

No branches or pull requests

2 participants