gitlab-org--gitlab-foss/changelogs/unreleased/46648-timeout-searching-group-issues.yml
Sean McGivern c03386c391 Force Postgres to avoid trigram indexes when in a group
When filtering issues with a search string in a group, we observed on GitLab.com
that Postgres was using an inefficient query plan, preferring the (global)
trigram indexes on description and title, rather than using a filter on the
restricted set of issues within the group.

Change the callers of the IssuableFinder to use a CTE in this case to fence the
rest of the query from the LIKE filters, so that the optimiser is forced to
perform the filter in the order we prefer.

This will only force the use of a CTE when:

1. The use_cte_for_search params is truthy.
2. We are using Postgres.
3. We have passed the `search` param.

The third item is important - searching issues using the search box does not use
the finder in this way, but contructs a query and appends `full_search` to
that. For some reason, this query does not suffer from the same issue.

Currenly, we only pass this param when filtering issuables (issues or MRs) in a
group context.
2018-06-07 10:23:09 +01:00

5 lines
118 B
YAML

---
title: Improve performance of group issues filtering on GitLab.com
merge_request: 19429
author:
type: performance