Faster manageable groups with linear queries
What does this MR do and why?
Enabling the use_traversal_ids_for_descendants_scopes feature flag creates a QA pipeline failure due to a database query timeout.
The fix is to replace the UNION
with a UNION ALL
wrapped by a SELECT DISTINCT ON (id)
. The UNION
performs a quicksort with all columns as the key. When we use UNION ALL
we can force using only the id
field for comparison.
Furthermore, the solution here provides a distinct_on
concern which would be useful elsewhere.
Describe in detail what your merge request does and why.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.