-
Notifications
You must be signed in to change notification settings - Fork 296
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
Fixes #36850 - Add indexes to speed up applicability calculation when there are lots of module streams installed #10773
Fixes #36850 - Add indexes to speed up applicability calculation when there are lots of module streams installed #10773
Conversation
applicability calculation when there are lots of module streams installed
[test katello] |
Before the migration, Also checked the DB index usage.
After console commands.
|
[test katello] |
🍏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Index does improve the performance 😄
@jeremylenz Can I propose this change? The reason is we have already given the solution to some customers by creating the indexes manually. As the created index name are not the same, duplicate indexes will be created. Thus, I am proposing to drop the old indexes and recreate them as below.
|
Hey @hao-yu Since this already-merged PR will benefit all users and not just the specific users you've created the indexes for manually, I would suggest giving this code to those specific users. (edit: also I don't really see any harm in having an unused index, either :) |
@jeremylenz we are not able to tell which users have applied the indexes manually. It could be many of them. My proposed change doesn't affect or cause bad impact to all other users. Can you please re-consider? I am happy to create a new PR with the amendment. |
Sure, but neither does keeping things the way they are? Even in this PR review above some of the indexes weren't used; I don't think it will hurt anything. And in principle I don't think it makes sense to make a patch in Katello that only fixes code that users have changed manually. Please feel free to raise another PR if you like, and we can bring more people in to the discussion. (I'm not the only Katello decision-maker :) But that's the way I feel for now. |
One of the index created in this patch was using a lot based on the review above. I am not exactly know how duplicate indexes will affect Postgres. If it will just ignore the duplicate then it is probably fine to leave them there and only some space are wasted. |
What are the changes introduced in this pull request?
Add indexes to the
katello_installed_packages
table. This should hopefully speed up applicability calculations when there are a lot of module streams installed.Considerations taken when implementing this change?
This is really tricky to test when you don't have a lot of hosts. The best testing steps I found are those @hao-yu gave us, I'll adapt them below
What are the testing steps for this pull request?
Steps to Reproduce:
Now, in Rails console, do this both before and after running the migration:
Do the benchmark 5-6 times in a row and take the average.
For my dev setup with a single rhel8 host - Typical benchmarks after the migration:
Before the migration, the
@real
was closer to .50 or .41. So not a huge improvement at this scale, but still measurable.