What if you run a logic app with sql connector instead of the function?
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Azure function, slooooow.
Collapse
X
-
-
-
The only other thing I can think of is a none azure specific issue such as a bad execution plan OPTION(RECOMPILE) on the azure function call to the proc or corruption in the buffer.
Edit: Are the database indexes and statistics fresh?
https://docs.microsoft.com/en-us/sql...s-transact-sql
Failing that try turning turing sql server on and off again if you can get a window to do that.Last edited by BlueSharp; 22 March 2018, 22:47.Make Mercia Great Again!Comment
-
I think it's very likely to be something related to the statistics/dodgy plan.Originally posted by BlueSharp View PostThe only other thing I can think of is a none azure specific issue such as a bad execution plan OPTION(RECOMPILE) on the azure function call to the proc or corruption in the buffer.
Edit: Are the database indexes and statistics fresh?
https://docs.microsoft.com/en-us/sql...s-transact-sql
Failing that try turning turing sql server on and off again if you can get a window to do that.
I think Mudskipper might be onto something with SET ARITHABORT ON. I've read a couple of answers on SO and people say it's sorted their problem out then others have pointed out that it may be a red herring and it's actually a dodgy plan.
I did try setting SET ARITHABORT ON in the stored procedure but no difference. But from what I've read the actual connection from ado.net trumps the stored procedure settings. So I'm going to attempt to change the code in the Azure function to set this on for the connection. Working with live data so will make the change and allow it to run in the morning.
I'm limited on time at the moment so going for the the low hanging fruit. But my feeling is it's actually not related to the function at all and as you have said it's db.Comment
-
There's also the parameter sniffing stuff. I changed my SPs to assign the passed parameters to local variables and use them in the query. Can't be sure whether it made a difference - my comment said " -- This might help... "Originally posted by woohoo View PostI think it's very likely to be something related to the statistics/dodgy plan.
I think Mudskipper might be onto something with SET ARITHABORT ON. I've read a couple of answers on SO and people say it's sorted their problem out then others have pointed out that it may be a red herring and it's actually a dodgy plan.
I did try setting SET ARITHABORT ON in the stored procedure but no difference. But from what I've read the actual connection from ado.net trumps the stored procedure settings. So I'm going to attempt to change the code in the Azure function to set this on for the connection. Working with live data so will make the change and allow it to run in the morning.
I'm limited on time at the moment so going for the the low hanging fruit. But my feeling is it's actually not related to the function at all and as you have said it's db.Comment
-
hah yeah, I'm currently reading this about parameter sniffing...Originally posted by mudskipper View PostThere's also the parameter sniffing stuff. I changed my SPs to assign the passed parameters to local variables and use them in the query. Can't be sure whether it made a difference - my comment said " -- This might help... "
Slow in the Application, Fast in SSMS?Comment
-
At the risk of stating the bleedin' obvious, you could try setting to OFF in the SP and see if it runs slow in SSMS - would at least indicate whether it's worth pursuing.Originally posted by woohoo View Post
I did try setting SET ARITHABORT ON in the stored procedure but no difference. But from what I've read the actual connection from ado.net trumps the stored procedure settings. So I'm going to attempt to change the code in the Azure function to set this on for the connection. Working with live data so will make the change and allow it to run in the morning.
https://docs.microsoft.com/en-us/sql...t-transact-sqlComment
-
I’ve read the article before thanks.
Just as easy to change the azure function. I’m having a day off and will take a look at it Sunday.Comment
-
Just in case anyone is interested. The Azure function timing reduced itself from 6 mins to 17 seconds without changing anything.
I didn't get a chance to deploy the change to the Azure function to SET ARITHABORT ON for the login session but if it helps someone else here is the code I pinched and tested.
Code:conn.StateChange += new StateChangeEventHandler(OnStateChange); conn.Open();
Code:private static void OnStateChange(object sender, StateChangeEventArgs args) { if (args.OriginalState == ConnectionState.Closed && args.CurrentState == ConnectionState.Open) { using (SqlCommand cmd = ((SqlConnection)sender).CreateCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = "SET ARITHABORT OFF;"; cmd.ExecuteNonQuery(); } } }Comment
-
Most unsatisfactoryOriginally posted by woohoo View PostThe Azure function timing reduced itself from 6 mins to 17 seconds without changing anything.
The black art of databases.
Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers

Comment