Project

General

Profile

Actions

Defect #43651

open

Searching issues with searchable custom fields causes a performance regression on MySQL

Added by Go MAEDA 1 day ago. Updated about 14 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Performance
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

When searching issues using the search box in the top-right corner, the response time can become extremely slow if the issues have searchable custom fields. In one of my clients' environments, response times increased from around 5 seconds in Redmine 6.0 to over a minute after upgrading to Redmine 6.1.

This issue is caused by an inefficient join order chosen by MySQL's optimizer. After the change introduced in #43214, MySQL may choose a plan that scans all rows in the custom_values table before filtering by issues.id. On large datasets, this results in a significant performance degradation.

This patch adds a MySQL optimizer hint JOIN_ORDER(issues, custom_values) in the search_result_ranks_and_ids method to force joining the issues table before custom_values, which avoids the inefficient plan and restores the previous performance.


Files


Related issues

Related to Redmine - Patch #43214: Optimize Project.allowed_to_condition by replacing `projects.status <> ...` with `projects.status IN (...)`ClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA about 14 hours ago

  • Target version changed from Candidate for next minor release to 6.1.2

Setting the target version to 6.1.2.

Actions #2

Updated by Go MAEDA about 14 hours ago

  • Related to Patch #43214: Optimize Project.allowed_to_condition by replacing `projects.status <> ...` with `projects.status IN (...)` added
Actions

Also available in: Atom PDF