It's all about the answers!

Ask a question

Why is retrieving all states of all workitems in a project area slow (RTC v2.x) ?

Tamir Klinger (91165) | asked Jul 02 '12, 9:11 p.m.
edited Jul 03 '12, 10:37 a.m.
Hi folks,

I need to retrieve all states of all workitems in a given project area from the client using the java API.  Currently this requirement is for a V2.x repo but I will shortly have to do the same thing for 3.x and 4.x.  My solution (cobbled together from various forum snippets.  Thank you forum) is to query for all the workitems in the project area and then do the following for each workItem:

List<IWorkItemHandle> workItemStateHandles = (List<IWorkItemHandle>) getItemManager()
                .fetchAllStateHandles(workItem, null);

Unfortunately, this seems to take an awfully long time -- on the order of 4 or 5 seconds per call with little or no network latency.  The server box is fast and there is nobody else using it.  It's a generic installation with all the default settings, except the database is db2 instead of derby.

With ~300,000 workitems to process, this isn't really a viable solution.  And it's difficult to understand what's taking so long since there are only about 10 states per workitem on average.

Is there some better way to do it?  Any thoughts?


Be the first one to answer this question!

Register or to post your answer.