Extremely high number of SQL statements executed for activity instance query [message #749208] |
Tue, 25 October 2011 00:57  |
Eclipse User |
|
|
|
Hi,
We are using following code to get a list of activity instances having associated data.
ActivityInstanceQuery activityInstanceQuery = ActivityInstanceQuery.findAll();
DataFilter dataFilter = DataFilter.in(dataID, disputeIDs);
activityInstanceQuery.getFilter().add(dataFilter);
ActivityInstanceState [] activityInstanceStates = new ActivityInstanceState [] {
ActivityInstanceState.Created,
ActivityInstanceState.Suspended,
ActivityInstanceState.Application
};
activityInstanceQuery.getFilter().add(new ActivityStateFilter(activityInstanceStates));
QueryService queryService = getQueryService(serviceFactory);
Collection activityInstances = queryService.getAllActivityInstances(activityInstanceQuery);
return activityInstances;
This method fires multiple queries while fetching the data. What we have observed here is, irrespective of number of disputeIDs being passed the method fires multiple queries.
Please let us know what might be causing such problem.
|
|
|
|
|
Re: Extremely high number of SQL statements executed for activity instance query [message #749232 is a reply to message #749227] |
Tue, 25 October 2011 01:15  |
Eclipse User |
|
|
|
So it looks like we have a different issue here. You have not defined descriptors at all. The problem is that the data you're using for your query is a Serializable, which will be serialized first and stored as multiple String snippets in STRING_DATA table. To do a comparison, the engine needs to load the data from STRING_DATA table. That's why you're observing hundreds of SELECT statements of type below, even though the actual result set would much smaller.
SELECT oid, objectid, data_type, data
FROM gpcarnot.STRING_DATA WHERE (gpcarnot.STRING_DATA.objectid = 25672 AND gpcarnot.STRING_DATA.data_type = 'data_value')
ORDER BY gpcarnot.STRING_DATA.oid ASC
SELECT dv.oid, dv.model, dv.data, dv.string_value, dv.number_value, dv.type_key, dv.processInstance
FROM gpcarnot.data_value dv
WHERE (dv.processInstance = 3637 AND dv.data = 281474976710667)
In those scenarios you should write the identifier (dispute ID) into a primitive process data once the Dispute is created. Primitives (strings or numbers) can be compared with what you're passing into query in one shot as part of the query itself.
|
|
|
Powered by
FUDForum. Page generated in 0.25044 seconds