release-20.1: sql: add cache for jobs to avoid querying system.jobs to find existing jobs#50923
Merged
RichardJCai merged 1 commit intocockroachdb:release-20.1from Jul 2, 2020
Conversation
Member
Contributor
|
Wait this (and the original PR) need a release note about the performance regression that was fixed. |
ajwerner
approved these changes
Jul 2, 2020
Contributor
ajwerner
left a comment
There was a problem hiding this comment.
Reviewed 5 of 5 files at r1.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @rohany)
Contributor
Author
Ah true, what should I do about the original PR? |
Contributor
I don't know... Ask in the slack? |
a4494e1 to
029c25e
Compare
…ng job Currently, we perform a loop through all existing jobs which involves querying a system table to check if there is an existing job for the current table undergoing a schema change. To avoid this query, we can use a cache to map TableIDs to jobs. Fixes cockroachdb#50165, cockroachdb#50783 Release note (bug fix): Fixed regression where granting privileges and dropping objects would be slow when performed on a large number of objects due to unnecessary queries for looking up jobs in the system.jobs. Previously we did a quadratic number of queries based on the number of objects. After this fix we do a linear number of queries based on the number of objects which significantly improves the speed of dropping multiple objects or granting multiple privileges to a user.
029c25e to
80cd3f4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #50848.
/cc @cockroachdb/release
Currently, we perform a loop through all existing jobs which involves
querying a system table to check if there is an existing job for the current
table undergoing a schema change. To avoid this query, we can use a cache
to map TableIDs to jobs.
Fixes #50165, #50783
Release note (bug fix): Fixed regression where granting privileges and dropping objects
would be slow when performed on a large number of objects due to unnecessary queries
for looking up jobs in the system.jobs.
Previously we did a quadratic number of queries based on the number of objects.
After this fix we do a linear number of queries based on the number of objects which
significantly improves the speed of dropping multiple objects or granting
multiple privileges to a user.