Project

General

Profile

Actions

Defect #43651

closed

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

Added by Go MAEDA 24 days ago. Updated 17 days ago.

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

0%

Estimated time:
Resolution:
Fixed
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 23 days 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 23 days ago

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

Updated by Go MAEDA 21 days ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix in r24289.

Actions #4

Updated by Go MAEDA 17 days ago

  • Status changed from Resolved to Closed

Merged the fix into 6.1-stable branch in r24311.

Actions

Also available in: Atom PDF