Performance regression in the unit association
https://github.com/pulp/pulp/pull/4008 In find_repo_content_units skip db query if expected result is empty
Added by rbikar over 1 year ago
find_repo_content_units: skip db query if expected result is empty (#4008)
- find_repo_content_units: skip db query if expected result is empty
For performance reasons, this change does server-side counting of units that are expected to be in result before actual db query happens. If expected count is zero, skip db query and continue to the next chunk of unit ids.
The performance problem is noticable in RHSM-pulp for big repos with 200k and more units associated. During associate action results of the most of queries in affected code will be empty so we can skip querying the db this way.
Without this fix, code will do eg. 200 unnecesary queries for repo with 200k units which will take a lot time to finish that leads to major performance regression.