Project

General

Profile

Actions

Patch #39849

closed

Optimize IssueCategory SQL queries when showing an issue

Added by Go MAEDA 12 months ago. Updated 11 months ago.

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

0%

Estimated time:

Description

The attached patch introduces a change in the _attributes.html.erb partial for issues, aimed at optimizing SQL queries related to issue categories. This change reduces an SQL query that checks the existence of issue category records.

Before:

  IssueCategory Exists? (0.4ms)  SELECT 1 AS one FROM "issue_categories" WHERE "issue_categories"."project_id" = $1 LIMIT $2  [["project_id", 1], ["LIMIT", 1]]
  ↳ app/views/issues/_attributes.html.erb:36
  IssueCategory Load (0.2ms)  SELECT "issue_categories".* FROM "issue_categories" WHERE "issue_categories"."project_id" = $1 ORDER BY "issue_categories"."name" ASC  [["project_id", 1]]
  ↳ app/views/issues/_attributes.html.erb:37:in `collect'

After:

  IssueCategory Pluck (0.2ms)  SELECT "issue_categories"."name", "issue_categories"."id" FROM "issue_categories" WHERE "issue_categories"."project_id" = $1 ORDER BY "issue_categories"."name" ASC  [["project_id", 1]]
  ↳ app/views/issues/_attributes.html.erb:35


Files

Actions

Also available in: Atom PDF