Make timestamp related queries faster

Bug #650930 reported by Markus Korn on 2010-09-29
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zeitgeist Framework
Fix Released
Markus Korn

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

Related branches

Markus Korn (thekorn) wrote :
Changed in zeitgeist:
status: New → In Progress
assignee: nobody → Markus Korn (thekorn)
Markus Korn (thekorn) wrote :

Once this fix has landed, I see even ways to improve time based queries if they are not using the cornercase "complete TimeRange", but we shouldn't take the second step before the first one...

Markus Korn (thekorn) on 2010-09-29
Changed in zeitgeist:
status: In Progress → Fix Committed
Seif Lotfy (seif) on 2010-10-13
Changed in zeitgeist:
milestone: none → 0.6
Markus Korn (thekorn) on 2010-11-01
Changed in zeitgeist:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers