My question is about performance on using Query List and Collection Operation.
I have a site workflow with a 5 branches parallel action. Each branch starts with a Query List which returns a collection of IDs, DueDates, Owners, and CTs. Then I have a for each loop that goes through the IDs collection, based on the Index the workflow does collection operations to get CT, Owner, and DueDate. I would like to know in term of performance isn't better to just get the IDs and then in the for each loop I add another query list to get Owner, DueDate, and CT based on the ID? Which one has the better performance?
Solved! Go to Solution.
I don't have any hard data to backup my statement so, take it as you will.
I believe the first scenario is more efficient because each branch only calls one query. All of the data is loaded into the collection variables, and then it simply loops through data it already has.
The second scenario queries a list for IDs and then requeries the exact same list for each and every ID. This mean, if you have 10 records, there are 11 queries, but if you have 100 records, there are 101 queries. In the first scenario, there's only one query no matter how many records.
Of course, this doesn't take into account the amount of data that scenario one has to hold throughout the entire workflow.
My best suggestion is to build out both solutions and check how long each one takes to run. You may need to add a large number of records in order to get a valid test though.
Personally, more often than not, I end up using scenario two for two reasons. First, it cuts down on the number of overall actions (although not the iterations). And secondly, it cuts down on the number of actions you have to configure, which ends up being a time saver for you, the workflow designer. I've never had any complaints about performance, but I can't recall ever building a workflow that needed that many iterations where the subsequent queries would cause an issue.