Improve performance of group work items query
What does this MR do and why?
Use a UNION instead of UNION ALL because it results in a much better query plan.
This is behind the namespace_level_work_items
feature flag. This is an alpha feature in active development.
This fixes the timeout that happens in https://gitlab.com/gitlab-org/plan-stage.
- Previous query: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/25418/commands/80532
- New query: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/25418/commands/80510
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Heinrich Lee Yu