I have a Azure SQL Stored Procedure, I use the "Execute stored procedure (V2)" to run it in the cloud flow.
Last week it return a 3000 rows table for only 30 seconds, but this week suddenly the workflow timeout always. The Stored procedure works fine by running directly in Azure Data Studio and maximum runs 59 seconds. It only run slow in Power Automate and timeout after 110 seconds. I checked that it might be the parameter sniffing in SQL, but I don't think fits my case.
Is there any changes for "Execute stored procedure (V2)" action recently? or any others from the community facing the same issue and find the solution?
I found the solution for this issue myself. It is about "Parameter Sniffing". I tried two solutions from this article https://www.linkedin.com/advice/0/what-best-practices-avoiding-parameter-sniffing
The first solution for avoiding parameter sniffing is to use local variables, this doesn't help. On the contrary it makes my stored procedure slower. Not sure why.
The fourth solution for avoiding parameter sniffing is to use RECOMPILE hints. This is the great savior for my stored procedure running by Power automate. I just added OPTION (RECOMPILE); at the end of my stored procedure, the the stored procedure running by Power Automate will always finish within 30 seconds. No timeout anymore.
OPTION (RECOMPILE);
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional