Markus Korn has proposed merging 
lp:~thekorn/zeitgeist/fix-672965-opt_timerange_queries into lp:zeitgeist.

Requested reviews:
  Zeitgeist Framework Team (zeitgeist)
Related bugs:
  #672965 find_event() queries with timerange other than TimeRange.always() are 
slow
  https://bugs.launchpad.net/bugs/672965


Made FindEvent queries faster if a timerange other than TimeRange.always()
is used (LP: #672965)
This is achieved by forcing the query planner to not use the timestamp index
for this kind of queries by using the unary '+' operator.
(see http://www.sqlite.org/optoverview.html section 6.0)
-- 
https://code.launchpad.net/~thekorn/zeitgeist/fix-672965-opt_timerange_queries/+merge/40412
Your team Zeitgeist Framework Team is requested to review the proposed merge of 
lp:~thekorn/zeitgeist/fix-672965-opt_timerange_queries into lp:zeitgeist.
=== modified file '_zeitgeist/engine/main.py'
--- _zeitgeist/engine/main.py	2010-10-25 09:48:49 +0000
+++ _zeitgeist/engine/main.py	2010-11-09 11:12:51 +0000
@@ -302,9 +302,9 @@
 		where = WhereClause(WhereClause.AND)
 		min_time, max_time = time_range
 		if min_time != 0:
-			where.add("timestamp >= ?", min_time)
+			where.add("+timestamp >= ?", min_time)
 		if max_time != sys.maxint:
-			where.add("timestamp <= ?", max_time)
+			where.add("+timestamp <= ?", max_time)
 		
 		where.extend(self._build_sql_from_event_templates(templates))
 		

=== modified file '_zeitgeist/engine/sql.py'
--- _zeitgeist/engine/sql.py	2010-10-25 20:26:03 +0000
+++ _zeitgeist/engine/sql.py	2010-11-09 11:12:51 +0000
@@ -47,6 +47,8 @@
 	
 	@staticmethod
 	def fix_unicode(obj):
+		if isinstance(obj, int):
+			return obj
 		if isinstance(obj, str):
 			obj = obj.decode("UTF-8")
 		return unicode(obj)		

_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to