Merge request searches respond with 500 on some queries
### Summary Some of the dashboard merge requests queries end up with a 500 error. It happens because they aren't optimized, but had to iterate over a lot of data. ### Steps to reproduce Visit: - https://gitlab.com/dashboard/merge_requests?scope=all&utf8=%E2%9C%93&state=merged&label_name[]=None - https://gitlab.com/dashboard/merge_requests?scope=all&utf8=%E2%9C%93&state=merged&wip=yes - https://gitlab.com/dashboard/merge_requests?scope=all&utf8=%E2%9C%93&state=opened&assignee_id=None - https://gitlab.com/groups/gitlab-org/-/merge_requests?scope=all&utf8=%E2%9C%93&state=merged&label_name[]=None ### What is the current *bug* behavior? The page displays 500 error because the query fails with timeout ### What is the expected *correct* behavior? The page returns correct results ### Possible fixes We can forbid using particular queries alone because listing all Draft merge requests or all merge requests without labels in the environment doesn't seem useful. We can return the same pages as for: https://gitlab.com/dashboard/merge_requests?scope=all&utf8=%E2%9C%93&state=opened&not[assignee_username]=igor.drozdov See https://gitlab.com/gitlab-org/gitlab/-/issues/373190+ for possible fix to speed up query
issue