Project

General

Profile

Actions

Feature #42671

closed

Avoid unnecessary SQL query for subprojects in ProjectsController#show when project has no children

Added by Go MAEDA 5 days ago. Updated 4 days ago.

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

0%

Estimated time:
Resolution:
Fixed

Description

The ProjectsController#show action always queries for subprojects using @project.children.visible.to_a, even when the current project is a leaf and has no subprojects.

  Project Load (0.2ms)  SELECT "projects".* FROM "projects" WHERE "projects"."parent_id" = ? AND (projects.status <> 9 AND projects.status <> 10) ORDER BY "projects"."lft" ASC  [["parent_id", 5]]
  ↳ app/controllers/projects_controller.rb:179:in 'block (2 levels) in ProjectsController#show'

This patch adds a check using @project.leaf? to skip the unnecessary query when the project has no children.


Files

Actions #1

Updated by Go MAEDA 4 days ago

  • Target version set to 6.1.0
Actions #2

Updated by Go MAEDA 4 days ago

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

Committed the patch in r23745.

Actions

Also available in: Atom PDF