cancel
Showing results for 
Search instead for 
Did you mean: 

using includeProcessVariables() in historyService.createHistoricProcessInstanceQuery()

justass
Champ in-the-making
Champ in-the-making
Hello,

   I am using historyService.createHistoricProcessInstanceQuery().includeProcessVariables()…..list() to create reports from historical process executions data. However, with more historic process executions, the createHistoricProcessInstanceQuery doesn't return not all the results.
In org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntityManager I found:

// setting max results, limit to 20000 results for performance reasons
historicProcessInstanceQuery.setMaxResults(20000);
historicProcessInstanceQuery.setFirstResult(0);

Does it mean, that using includeProcessVariables() is not recommended for historic queries? Should I first get all HistoricProcessInstance and then retrieve historic variables?

Thanks.
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
20 000 results is a lot - as shown in the code there, a lot is done in-memory.

What is your use case for needing so much data in one go?

justass
Champ in-the-making
Champ in-the-making
The use case was to create simple report. There are a lot process executions (more than 20000 so far), and I needed to collect 5 string variable values from each process and show a list to user. I ended up using plain sql queries for that.

I think it would be good to mention hardcoded 20000 limitation (or let the user change the default value) in user guide. It would help the developers to avoid surprises when query stops returning expected results after some time Smiley Happy