[Rt-devel] Optimizing _BuildItemMap / ItemsArrayRef in Tickets_Overlay.pm

Gene Hsu rt at hsufarm.com
Tue Apr 26 17:11:56 EDT 2005


On Tue, Apr 26, 2005 at 03:47:07PM -0400, Jesse Vincent wrote:
> 
> > > What's your realistic test case?
> > 
> > Probably on the order of 1000 tickets.  That's only 4MB, but that still 
> > takes time.
> 
> In most cases, your ticket searches are going to be limited to pages,
> usually of 25,50 or 100 items. What's the use case you're running into
> this being any sort of an issue?

The order 1000 is a typical max case (hopefully).

Here's a use case:

On an fairly active queue,
Select all (new|open|stalled) cases. say 1000 tickets
The search results are paginated (no problem here).
Choose a ticket in the search results.
/Ticket/Elements/Tabs is called
my $item_map = $session{'tickets'}->ItemMap;
RT::Tickets::ItemMap calls _BuildItemMap
RT::Tickets::_BuildItemMap calls ItemsArrayRef
1000 Tickets get read
1000 Tickets get sorted
_BuildItemMap constructs next/prev links from ItemsArrayRef
...
Serialize first/prev/next/last information in session data
Construct First/Pref/Next/Last links in tabs.

It would be nice if instead of calling ItemsArrayRef and reading all the
ticket data if something else gets called to only load the ids.  I hope
this example is a lot clearer than my initial request.  On subsequent 
displays of tickets in the search, there is no problem since all of the
next/prev information is in the session data.

-- Gene

> > > > 
> > > > Can _BuildItemMap be written such that it doesn't use ItemsArrayRef and
> > > > uses a custom SQL query that pulls down only the ticket ids, instead?
> > > > 
> > > > -- Gene
> > 
> > -- Gene
> > 
> 
> -- 


More information about the Rt-devel mailing list