← Back to team overview

zeitgeist team mailing list archive

[Bug 650930] Re: Make timestamp related queries faster

 

** Branch linked: lp:zeitgeist

-- 
Make timestamp related queries faster
https://bugs.launchpad.net/bugs/650930
You received this bug notification because you are a member of Zeitgeist
Framework Team, which is subscribed to Zeitgeist Framework.

Status in Zeitgeist Framework: Fix Committed

Bug description:
When grep'ing the source of `unity-place-applications` and `unity-place-files` you will find out that these two products are using the FindEvents method, and both products are using this method to query for the complete time interval [0, sys.maxint] (aka. TimeRange.always()). And I've seen similar queries in other clients too. So I think it is worth trying to optimize the query for this kind of queries.

The attached script is timing the exactly same query which is used in `unity-place-applications` on a database which contains 50k events, with 100 randomly choosen different actors.

On lp:zeitgeist the find_events query returns the 6 events with most popular actors in ~0.22s
---> MostPopularActor: get len(ids)=6 using .find_eventids() in 0.224661s

By making the sql queries on the timestamp column conditional we will be able to reduce this time to
---> MostPopularActor: get len(ids)=6 using .find_eventids() in 0.069161s





References