← Back to team overview

launchpad-reviewers team mailing list archive

lp:~allenap/launchpad/localpackagediffs-time-out-bug-798301-alt2 into lp:launchpad

 

Gavin Panella has proposed merging lp:~allenap/launchpad/localpackagediffs-time-out-bug-798301-alt2 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #798301 in Launchpad itself: "Time-out on +localpackagediffs"
  https://bugs.launchpad.net/launchpad/+bug/798301

For more details, see:
https://code.launchpad.net/~allenap/launchpad/localpackagediffs-time-out-bug-798301-alt2/+merge/65636

The realisation that a join via DistroSeries was not needed has finally hit after Jeroen asked just the right questions and drew ascii pictures for me :)

Query plans for production indicate that this query now runs in just over 700ms in a warm cache. I tried removing the +0 index busting hack, but performance dived again.

-- 
https://code.launchpad.net/~allenap/launchpad/localpackagediffs-time-out-bug-798301-alt2/+merge/65636
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/localpackagediffs-time-out-bug-798301-alt2 into lp:launchpad.
=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py	2011-06-23 09:01:56 +0000
+++ lib/lp/registry/model/distroseriesdifference.py	2011-06-23 09:52:28 +0000
@@ -132,21 +132,18 @@
     if in_parent:
         conditions = And(
             conditions,
-            DistroSeries.id == DistroSeriesDifference.parent_series_id,
             SourcePackagePublishingHistory.distroseriesID == (
                 DistroSeriesDifference.parent_series_id),
             )
     else:
         conditions = And(
             conditions,
-            DistroSeries.id == DistroSeriesDifference.derived_series_id,
             SourcePackagePublishingHistory.distroseriesID == (
                 DistroSeriesDifference.derived_series_id),
             )
     # Ensure that the archive has the right purpose.
     conditions = And(
         conditions,
-        Archive.distributionID == DistroSeries.distributionID,
         # DistroSeries.getPublishedSources() matches on MAIN_ARCHIVE_PURPOSES,
         # but we are only ever going to be interested in PRIMARY archives.
         Archive.purpose == ArchivePurpose.PRIMARY,