Merge lp:~wgrant/launchpad/upcoming-optimisation-mk2 into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 18403
Proposed branch: lp:~wgrant/launchpad/upcoming-optimisation-mk2
Merge into: lp:launchpad
Diff against target: 16 lines (+5/-1)
1 file modified
lib/lp/registry/model/ (+5/-1)
To merge this branch: bzr merge lp:~wgrant/launchpad/upcoming-optimisation-mk2
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email:

Commit message

Force +upcomingwork to apply the spec privacy check only to relevant specs.

Description of the change

Force +upcomingwork to apply the spec privacy check only to relevant specs.

The seq scan for the join in the outer query is fine, but we need to
avoid applying the privacy check to everything. It looks like the ACL
array intersection is starting to get untenable for some users over a
hundred thousand specs.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/model/'
2--- lib/lp/registry/model/ 2017-06-06 11:28:27 +0000
3+++ lib/lp/registry/model/ 2017-06-08 10:03:51 +0000
4@@ -1459,7 +1459,11 @@
5 origin = [Specification]
6 productjoin, query = get_specification_active_product_filter(self)
7 origin.extend(productjoin)
8- query.extend(get_specification_privacy_filter(user))
9+ query.append(Exists(Select(
10+ 1, tables=[Specification],
11+ where=And(
12+ == SpecificationWorkItem.specification_id,
13+ *get_specification_privacy_filter(user)))))
14 origin.extend([
15 Join(SpecificationWorkItem,
16 SpecificationWorkItem.specification ==,