summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-10-18 17:25:21 -0500
committerDan McGee <dan@archlinux.org>2014-10-18 17:25:21 -0500
commit0e90423fc09f53317992bbb024e82ef65728aa11 (patch)
tree40d3f6da0970b7e722fecd72e62f0cd5d0112ead /packages
parent122302e9e5fb9752a942abe5691ad3dd6d186196 (diff)
downloadarchweb-0e90423fc09f53317992bbb024e82ef65728aa11.tar.gz
archweb-0e90423fc09f53317992bbb024e82ef65728aa11.zip
Add possible optimization as a TODO for later
Diffstat (limited to 'packages')
-rw-r--r--packages/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/models.py b/packages/models.py
index dd69e7d3..03f03422 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -379,6 +379,13 @@ class RelatedToBase(models.Model):
given criteria. It will not search provisions, but will find packages
named and matching repo characteristics if possible.'''
pkgs = Package.objects.normal().filter(pkgname=self.name)
+ # TODO: this may in fact be faster- select only the fields we know will
+ # actually get used, saving us some bandwidth and hopefully query
+ # construction time. However, reality hasn't quite proved it out yet.
+ #pkgs = Package.objects.select_related('repo', 'arch').only(
+ # 'id', 'pkgname', 'epoch', 'pkgver', 'pkgrel',
+ # 'repo__id', 'repo__name', 'repo__testing', 'repo__staging',
+ # 'arch__id', 'arch__name').filter(pkgname=self.name)
if not self.pkg.arch.agnostic:
# make sure we match architectures if possible
arches = self.pkg.applicable_arches()