Commit 1ccdc069 authored by Toon Claes's avatar Toon Claes

Merge branch '204720-pghintplan-test' into 'master'

Use pg_hint_plan for IssuableFinder

See merge request gitlab-org/gitlab!46289
parents ea0632b5 80057bed
......@@ -339,6 +339,15 @@ class IssuableFinder
cte << items
items = klass.with(cte.to_arel).from(klass.table_name)
elsif Feature.enabled?(:pg_hint_plan_for_issuables, params.project)
items = items.optimizer_hints(<<~HINTS)
BitmapScan(
issues idx_issues_on_project_id_and_created_at_and_id_and_state_id
idx_issues_on_project_id_and_due_date_and_id_and_state_id
idx_issues_on_project_id_and_updated_at_and_id_and_state_id
index_issues_on_project_id_and_iid
)
HINTS
end
items.full_search(search, matched_columns: params[:in], use_minimum_char_limit: !use_cte_for_search?)
......
---
name: pg_hint_plan_for_issuables
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46289
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/273528
type: development
group: group::project planning
default_enabled: false
......@@ -472,6 +472,10 @@ RSpec.describe IssuesFinder do
it 'returns issues with title and description match for search term' do
expect(issues).to contain_exactly(issue1, issue2)
end
it 'uses optimizer hints' do
expect(issues.to_sql).to match(/BitmapScan/)
end
end
context 'filtering by issue term in title' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment