Actions
Patch #39849
closedOptimize IssueCategory SQL queries when showing an issue
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