I've made a couple of similar optimizations. In my case, I've added a method to the corresponding `*Set` class that would load the necessary data for multiple objects at once, using a single database query. In your case it would mean loading published sources for multiple archives.
The `archive.getPublishedSources` method could be updated to call the new method from `ArchiveSet` to get published sources with a single-item list of archives. -- https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/431724 Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:optimize-distribution-has-published-sources-queries into launchpad:master. _______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp

