Closed Bug 364160 Opened 18 years ago Closed 12 years ago

Inefficient SQL: Bugzilla/User.pm can_see_bug permission check

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

2.23.3
defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 3.4

People

(Reporter: bugzilla-mozilla, Assigned: mkanat)

References

Details

(Keywords: perf, Whiteboard: [fixed by blocker])

The following SQL is called 6 times for a page load. The result should be cached and used again.

The SQL comes from can_see_bug in Bugzilla/Bug.pm.

   SELECT 1, reporter, assigned_to, qa_contact,
          reporter_accessible, cclist_accessible,
          COUNT(cc.who), COUNT(bug_group_map.bug_id)
     FROM bugs
LEFT JOIN cc
       ON cc.bug_id = bugs.bug_id AND cc.who = 5407
LEFT JOIN bug_group_map
       ON bugs.bug_id = bug_group_map.bug_id
          AND bug_group_map.group_ID NOT IN(16,12,3,9,13,15,4,1,6,14,11,2,5,7,8)
    WHERE bugs.bug_id = '163163'
      AND creation_ts IS NOT NULL
 GROUP BY bugs.bug_id

For the whole SQL log, please see attachment 248929 [details].
This should only be cached if it takes more than 0.3 seconds for all six queries, or if the cache doesn't introduce any more code complexity.
Assignee: general → create-and-change
Severity: normal → minor
Component: Bugzilla-General → Creating/Changing Bugs
AFAICT, this problem has been fixed with the implementation of visible_bugs(), see bug 440656.
Assignee: create-and-change → mkanat
Status: NEW → RESOLVED
Closed: 12 years ago
Depends on: 440656
Resolution: --- → FIXED
Whiteboard: [fixed by blocker]
Target Milestone: --- → Bugzilla 3.4
You need to log in before you can comment on or make changes to this bug.