Thursday, August 6, 2015

Broken By Default

A web application of mine started timing out waiting for a SQL query to return results. The query ran in less than a second in enterprise manager, but took more than 30 seconds when called from the web server. I was amazed to discover after Googling I was amazed to discover that to get the query to return in less than one second from the web page you have to put the words SET ARITHABORT ON in the stored procedure.

I'm not terribly surprised given Microsoft's track record that the default setting for ASP.NET pages causes them to break but why would it be different in enterprise manager than it is for applications? It sure does make troubleshooting take longer!

To break it down, just for you, Microsoft --

Problem #1: ARITHABORT is set to off by default for ASP.Net applications. This causes applications to work initially and then fail some random time later.

Solution: Set ARITHABORT on by default. Thanks for assuming that I wanted my query to take as long as possible, but I'd really like it as fast as possible.

Problem #1: ARITHABORT is set to different settings in SQL Enterprise Manager and for applications.

Solution: Set them to be the same! It sure would be nice if those troubleshooting didn't have to look for a secret switch to flip before the SQL behavior becomes consistent.

No comments:

Post a Comment