← Back to team overview

zeitgeist team mailing list archive

[Merge] lp:~thekorn/zeitgeist/fix-650930-opt-complete-timerange into lp:zeitgeist

 

Markus Korn has proposed merging lp:~thekorn/zeitgeist/fix-650930-opt-complete-timerange into lp:zeitgeist.

Requested reviews:
  Zeitgeist Framework Team (zeitgeist)
Related bugs:
  #650930 Make timestamp related queries faster
  https://bugs.launchpad.net/bugs/650930


If FindEvents-queries are run over the complete TimeRange intervall don't add timestamp conditions to the SQL statement (LP: #650930)

To see speed improvements run the script attached to bug 650930 in lp:zeitgeist and in this branch.
-- 
https://code.launchpad.net/~thekorn/zeitgeist/fix-650930-opt-complete-timerange/+merge/36962
Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~thekorn/zeitgeist/fix-650930-opt-complete-timerange into lp:zeitgeist.
=== modified file '_zeitgeist/engine/main.py'
--- _zeitgeist/engine/main.py	2010-09-25 13:19:51 +0000
+++ _zeitgeist/engine/main.py	2010-09-29 08:44:44 +0000
@@ -307,8 +307,11 @@
 			raise NotImplementedError
 		
 		where = WhereClause(WhereClause.AND)
-		where.add("timestamp >= ?", time_range[0])
-		where.add("timestamp <= ?", time_range[1])
+		min_time, max_time = time_range
+		if min_time != 0:
+			where.add("timestamp >= ?", min_time)
+		if max_time != sys.maxint:
+			where.add("timestamp <= ?", max_time)
 		
 		where.extend(self._build_sql_from_event_templates(templates))