Add possible optimization as a TODO for later

This commit is contained in:
Dan McGee 2014-10-18 17:25:21 -05:00
parent 122302e9e5
commit 0e90423fc0

View File

@ -379,6 +379,13 @@ def get_best_satisfier(self):
given criteria. It will not search provisions, but will find packages given criteria. It will not search provisions, but will find packages
named and matching repo characteristics if possible.''' named and matching repo characteristics if possible.'''
pkgs = Package.objects.normal().filter(pkgname=self.name) 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: if not self.pkg.arch.agnostic:
# make sure we match architectures if possible # make sure we match architectures if possible
arches = self.pkg.applicable_arches() arches = self.pkg.applicable_arches()