launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06370
[Merge] lp:~wgrant/launchpad/bug-932433 into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/bug-932433 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #932433 in Launchpad itself: "DistroSeriesSet.getCurrentSourceReleases is slow"
https://bugs.launchpad.net/launchpad/+bug/932433
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-932433/+merge/93110
Now that SPPH.sourcepackagename exists and is populated, most package queries can be fully selective on just SPPH, allowing postgres to be quick with its BitmapAnd magic. This branch changes DistroSeriesSet.getCurrentSourceReleases to take advantage of this, taking it down from ~25ms to ~1ms with hot indices.
--
https://code.launchpad.net/~wgrant/launchpad/bug-932433/+merge/93110
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-932433 into lp:launchpad.
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2012-02-08 06:00:46 +0000
+++ lib/lp/registry/model/distroseries.py 2012-02-15 00:33:20 +0000
@@ -1846,7 +1846,7 @@
# wrapped anyway - and sqlvalues goes boom.
archives = removeSecurityProxy(
distroseries.distribution.all_distro_archive_ids)
- clause = """(spr.sourcepackagename IN %s AND
+ clause = """(spph.sourcepackagename IN %s AND
spph.archive IN %s AND
spph.distroseries = %s)
""" % sqlvalues(source_package_ids, archives, distroseries.id)
@@ -1860,7 +1860,8 @@
(SourcePackageRelease, DistroSeries.id), SQL("""
(SourcePackageRelease.id, DistroSeries.id) IN (
SELECT
- DISTINCT ON (spr.sourcepackagename, spph.distroseries)
+ DISTINCT ON (
+ spph.sourcepackagename, spph.distroseries)
spr.id, spph.distroseries
FROM
SourcePackageRelease AS spr,
@@ -1870,7 +1871,9 @@
AND spph.status IN %s
AND %s
ORDER BY
- spr.sourcepackagename, spph.distroseries, spph.id DESC
+ spph.sourcepackagename,
+ spph.distroseries,
+ spph.id DESC
)
"""
% (sqlvalues(active_publishing_status) + (combined_clause,))))