[LNT] r312605 - Slightly optimize some counting queries
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 5 19:03:45 PDT 2017
Author: matze
Date: Tue Sep 5 19:03:45 2017
New Revision: 312605
URL: http://llvm.org/viewvc/llvm-project?rev=312605&view=rev
Log:
Slightly optimize some counting queries
Modified:
lnt/trunk/lnt/server/db/testsuitedb.py
Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=312605&r1=312604&r2=312605&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Tue Sep 5 19:03:45 2017
@@ -1130,16 +1130,16 @@ class TestSuiteDB(object):
return "TestSuiteDB('%s')" % self.name
def getNumMachines(self, session):
- return session.query(self.Machine).count()
+ return session.query(sqlalchemy.func.count(self.Machine.id)).scalar()
def getNumRuns(self, session):
- return session.query(self.Run).count()
+ return session.query(sqlalchemy.func.count(self.Run.id)).scalar()
def getNumSamples(self, session):
- return session.query(self.Sample).count()
+ return session.query(sqlalchemy.func.count(self.Sample.id)).scalar()
def getNumTests(self, session):
- return session.query(self.Test).count()
+ return session.query(sqlalchemy.func.count(self.Test.id)).scalar()
def get_field_index(self, sample_field):
return self.sample_field_indexes[sample_field.name]
More information about the llvm-commits
mailing list