In recent days I’ve had a look at performance in Microsoft Flow and how to improve the performance of my flows with easy steps or patterns. We all know that nested Apply to each steps are not a great idea or maybe …

Therefore I started by creating some nested apply to each steps. If you do a bad job then do at least a really bad job!

A Flow with Many Apply to Each stepsI’ve got a number of set variable actions and a number of compose actions. All of these are building up some HTML out of data collected from SharePoint using Get Items actions.

To run all of this within an apply to each about 45 times takes 16 minutes. Pretty performance poor isn’t it?

I decided to optimise the flow a bit by adding Select statements straight after the Get Items actions and I gained 10 minutes. Simply by adding all the complexity into a single select my flow started to perform a lot better

Optimized flows using Select actions.I always thought that the usage of the variables would really cause the performance trouble as Flow is waiting for  locks on the variables. Both versions of the flow are using the same number of variables and the same number of compose actions.

Time to look at the details.

Within the original Flow within the Apply to each there were a lot of expressions used. Moving these expressions from the nested apply to each steps to a single Select action reduced the complexity in the nested Apply-to each steps.

In the optimised flow I put all my expressions in the Select action.

A Select Action shaping my data

This now means that as I use a Set Variable inside my apply for each becomes very simple a set of references to my data returned by the select.

Simple set variable action using data from Select

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: